-
Notifications
You must be signed in to change notification settings - Fork 422
Expand file tree
/
Copy pathUSGSWells.js
More file actions
182 lines (161 loc) · 9.88 KB
/
Copy pathUSGSWells.js
File metadata and controls
182 lines (161 loc) · 9.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
/*
* Copyright 2003-2006, 2009, 2017, 2020 United States Government, as represented
* by the Administrator of the National Aeronautics and Space Administration.
* All rights reserved.
*
* The NASAWorldWind/WebWorldWind platform is licensed under the Apache License,
* Version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License
* at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* NASAWorldWind/WebWorldWind also contains the following 3rd party Open Source
* software:
*
* ES6-Promise – under MIT License
* libtess.js – SGI Free Software License B
* Proj4 – under MIT License
* JSZip – under MIT License
*
* A complete listing of 3rd Party software notices and licenses included in
* WebWorldWind can be found in the WebWorldWind 3rd-party notices and licenses
* PDF found in code directory.
*/
define(['../../src/WorldWind',
'../util/GoToBox',
'../util/LayersPanel',
'../util/ProjectionMenu',
'../util/TerrainOpacityController'],
function (ww,
GoToBox,
LayersPanel,
ProjectionMenu,
TerrainOpacityController) {
"use strict";
var USGSWells = function () {
WorldWind.Logger.setLoggingLevel(WorldWind.Logger.LEVEL_WARNING);
// Create the WorldWindow.
this.wwd = new WorldWind.WorldWindow("canvasOne");
// Configure the WorldWindow layers.
var layers = [
{layer: new WorldWind.BingAerialWithLabelsLayer(null), enabled: true},
{layer: new WorldWind.OpenStreetMapImageLayer(null), enabled: false},
{layer: new WorldWind.CompassLayer(), enabled: true, hide: true},
{layer: new WorldWind.CoordinatesDisplayLayer(this.wwd), enabled: true, hide: true},
{layer: new WorldWind.ViewControlsLayer(this.wwd), enabled: true, hide: true}
];
for (var l = 0; l < layers.length; l++) {
layers[l].layer.enabled = layers[l].enabled;
layers[l].layer.hide = layers[l].hide;
this.wwd.addLayer(layers[l].layer);
}
// Configure the USGS installed well layers.
var layer = new WorldWind.RenderableLayer("USGS Wells");
this.addWellShape(33.098751, -117.01714, 270, 30, "Cloverdale - SDCD (12S/1W-30J3-5)\nPerforation depth 190-270 (ft)", layer);
this.addWellShape(33.087345, -116.974756, 340, 30, "Santa Ysabel - SDSY (12S/1W-34L2-5)\nPerforation depth 280-340 (ft)", layer);
this.addWellShape(33.055677, -117.046409, 270, 30, "Lake Hodges - SDSY (13S/2W-12M1-3)\nPerforation depth 170-250 (ft)", layer);
this.addWellShape(33.008894, -117.262179, 1120, 30, "San Elijo - SDSE (13S/4W-26Q1-3)\nPerforation depth 300-1220 (ft)", layer);
this.addWellShape(32.778096, -117.120867, 940, 30, "Aqua Culture - SDAQ (16S/2W-18J3-7)\nPerforation depth 840-940 (ft)", layer);
this.addWellShape(32.737766, -117.072251, 1100, 30, "Chollas Park - SDCP (16S/2W-34G1-6)\nPerforation depth 920-1060 (ft)", layer);
this.addWellShape(32.721841, -117.142123, 1490, 30, "Balboa Park - SDBP (17S/3W-1K1-5)\nPerforation depth 1470-1490 (ft)", layer);
this.addWellShape(32.718938, -117.109959, 1620, 30, "Home & Federal - SDHF (17S/2W-5Q1-6)\nPerforation depth 1580-1620 (ft)", layer);
this.addWellShape(32.687799, -117.085609, 1300, 30, "El Toyon Park - SDEP (17S/2W-16Q9-13)\nPerforation depth 1260-1300 (ft)", layer);
this.addWellShape(32.682085, -117.112392, 1500, 30, "Naval Base - SDNB (17S/2W-20F1-5)\nPerforation depth 1460-1500 (ft)", layer);
this.addWellShape(32.659041, -117.085590, 1990, 30, "Sweetwater - SDSW (17S/2W-28R4-9)\nPerforation depth 1810-1850 (ft)", layer);
this.addWellShape(32.654419, -117.098256, 1480, 30, "Mile of Cars - SDMC (17S/2W-33D1-5)\nPerforation depth 1440-1480 (ft)", layer);
this.addWellShape(32.616602, -117.059423, 1720, 30, "Country Club - SDCC (18S/2W-11P1-6)\nPerforation depth 1660-1700 (ft)", layer);
this.addWellShape(32.591241, -117.053904, 1472, 30, "Otay River - SDOR (18S/2W-23G2-6)\nPerforation depth 1420-1460 (ft)", layer);
this.addWellShape(32.553649, -117.061615, 1430, 30, "Boundary Waters - SDBW (19S/2W-2C7-11)\nPerforation depth 1340-1360 (ft)", layer);
this.wwd.addLayer(layer);
// Enable sub-surface rendering for the WorldWindow.
this.wwd.subsurfaceMode = true;
// Enable deep picking in order to detect the sub-surface shapes.
this.wwd.deepPicking = true;
// Make the surface semi-transparent in order to see the sub-surface shapes.
this.wwd.surfaceOpacity = 0.5;
// Start the view pointing to a location near the well data.
var lookAt = new WorldWind.LookAt();
lookAt.position.latitude = 33.0977;
lookAt.position.longitude = -117.0119;
lookAt.range = 1400;
lookAt.heading = 90;
lookAt.tilt = 60;
this.wwd.cameraFromLookAt(lookAt);
// Establish the shapes and the controllers to handle picking.
this.setupPicking();
// Create controllers for the user interface elements.
this.goToBox = new GoToBox(this.wwd);
this.layersPanel = new LayersPanel(this.wwd);
this.projectionMenu = new ProjectionMenu(this.wwd);
this.terrainOpacityController = new TerrainOpacityController(this.wwd);
};
USGSWells.prototype.addWellShape = function (latitude, longitude, depthFeet, radiusFeet, displayText, layer) {
var boundary = [],
feetToMeters = 0.3048,
center = new WorldWind.Location(latitude, longitude),
altitude = -depthFeet * 0.3048,
radius = radiusFeet * feetToMeters / this.wwd.globe.radiusAt(latitude, longitude),
numSegments = 32,
da = 360 / numSegments;
for (var i = 0, len = numSegments + 1; i < len; i++) {
var angle = (i != numSegments) ? i * da : 0,
position = new WorldWind.Position(0, 0, altitude);
boundary.push(WorldWind.Location.greatCircleLocation(center, angle, radius, position));
}
var polygon = new WorldWind.Polygon([boundary]);
polygon.pickDelegate = displayText;
polygon.altitudeMode = WorldWind.RELATIVE_TO_GROUND;
polygon.extrude = true;
polygon.attributes.interiorColor = new WorldWind.Color(0.22, 0.65, 0.87, 1.0);
polygon.attributes.outlineColor = WorldWind.Color.BLUE;
polygon.attributes.applyLighting = true;
polygon.highlightAttributes = new WorldWind.ShapeAttributes(polygon.attributes);
polygon.highlightAttributes.interiorColor = WorldWind.Color.WHITE;
layer.addRenderable(polygon);
var placemark = new WorldWind.Placemark(new WorldWind.Position(latitude, longitude, 0));
placemark.pickDelegate = displayText;
placemark.altitudeMode = WorldWind.RELATIVE_TO_GROUND;
placemark.eyeDistanceScaling = true;
placemark.attributes.imageSource = WorldWind.configuration.baseUrl + "images/white-dot.png";
placemark.attributes.imageColor = WorldWind.Color.RED;
placemark.attributes.imageScale = 0.15;
layer.addRenderable(placemark);
};
USGSWells.prototype.setupPicking = function () {
this.screenText = new WorldWind.ScreenText(new WorldWind.Offset(WorldWind.OFFSET_PIXELS, 0, WorldWind.OFFSET_PIXELS, 0), " ");
this.screenText.attributes = new WorldWind.TextAttributes();
this.screenText.attributes.color = WorldWind.Color.YELLOW;
this.screenText.attributes.offset = new WorldWind.Offset(WorldWind.OFFSET_FRACTION, 0, WorldWind.OFFSET_FRACTION, 0);
this.textLayer = new WorldWind.RenderableLayer();
this.textLayer.hide = true;
this.textLayer.enabled = false;
this.textLayer.addRenderable(this.screenText);
this.wwd.addLayer(this.textLayer);
var handlePick = (function (o) {
var pickPoint = this.wwd.canvasCoordinates(o.clientX, o.clientY);
this.textLayer.enabled = false;
this.wwd.redraw();
var pickList = this.wwd.pick(pickPoint);
if (pickList.objects.length > 0) {
for (var p = 0; p < pickList.objects.length; p++) {
var pickedObject = pickList.objects[p];
if (typeof pickedObject.userObject === "string") {
this.screenText.screenOffset.x = pickPoint[0];
this.screenText.screenOffset.y = this.wwd.viewport.width - pickPoint[1];
this.screenText.text = pickedObject.userObject;
this.textLayer.enabled = true;
}
}
}
}).bind(this);
// Listen for mouse moves and highlight the placemarks that the cursor rolls over.
this.wwd.addEventListener("mousemove", handlePick);
// Listen for taps on mobile devices and highlight the placemarks that the user taps.
var tapRecognizer = new WorldWind.TapRecognizer(this.wwd, handlePick);
};
return USGSWells;
});