| 1 |
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "https://www.web3d.org/specifications/x3d-3.3.dtd">
|
| 3 | <X3D profile='Immersive' version='3.3' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.3.xsd'> |
| 4 | <head> |
| 5 | <component level='1' name='Geospatial'/> |
| 6 | <meta name='title' content=' KmlPrototypes.x3d '/> |
| 7 | <meta name='description' content='X3D prototypes to render Keyhole Markup Language (KML) information.'/> |
| 8 | <meta name='translated' content='20 August 2007'/> |
| 9 | <meta name='modified' content='20 October 2019'/> |
| 10 | <meta name='creator' content='Don Brutzman'/> |
| 11 | <meta name=' warning ' content=' under development '/> |
| 12 | <meta name='identifier' content=' https://www.web3d.org/x3d/content/examples/Basic/Geospatial/KmlPrototypes.x3d '/> |
| 13 | <meta name='reference' content='http://www.opengeospatial.org/standards/kml'/> |
| 14 | <meta name='reference' content='http://schemas.opengis.net/kml'/> |
| 15 | <meta name='reference' content='http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd'/> |
| 16 | <meta name='reference' content=' KmlToX3d.xslt '/> |
| 17 | <meta name='generator' content='X3D-Edit 3.3, https://www.web3d.org/x3d/tools/X3D-Edit'/> |
| 18 | <meta name='license' content='../license.html'/> |
| 19 | </head> |
| 20 | <Scene> |
| 21 | <ProtoDeclare name='PlaceMark' appinfo='A Placemark with a Point has an icon associated with it that marks a point on the earth in the 3D viewer.' documentation='http://code.google.com/apis/kml/documentation/kml_tags_21.html#placemark'> |
| 22 | <ProtoInterface> |
| 23 | <field name='id' type='SFString' accessType='initializeOnly'/> |
| 24 |
<field name='name' type='MFString' accessType='inputOutput'
appinfo='Label for the object'/> |
| 25 |
<field name='description' type='SFString' accessType='inputOutput'
appinfo='User-supplied text that appears in the description balloon'/> |
| 26 |
<field name='coordinates' type='SFVec3d' value='0 0 0' accessType='initializeOnly'
appinfo='longitude latitude and altitude'/> |
| 27 |
<field name='address' type='MFString' accessType='inputOutput'
appinfo='A string value representing an unstructured address written as a standard street city state address and/or as a postal code.'/> |
| 28 |
<field name='visibility' type='SFBool' value='true' accessType='initializeOnly'
appinfo='. Specifies whether the feature is drawn in the 3D viewer when it is initially loaded'/> |
| 29 | <field name='set_visibility' type='SFBool' accessType='inputOnly'/> |
| 30 | <field name='visibility_changed' type='SFBool' accessType='outputOnly'/> |
| 31 | <!-- TODO: is the 'open' parameter appropriate for X3D? Maintain value for round-trip conversions. --> |
| 32 |
<field name='open' type='SFBool' value='true' accessType='initializeOnly'
appinfo='Specifies whether a Folder appears closed or open when first loaded'/> |
| 33 | <!-- TODO: need LookAt Prototype --> |
| 34 |
<field name='snippet' type='MFString' accessType='initializeOnly'
appinfo='A short description of the feature'/> |
| 35 | <field name='set_snippet' type='MFString' accessType='inputOnly'/> |
| 36 | <field name='snippet_changed' type='MFString' accessType='outputOnly'/> |
| 37 | <!-- TODO: AddressDetails, phoneNumber, TimePrimitive, styleUrl, StyleSelector, Region --> |
| 38 | <!-- TODO: Geometry prototypes for KML Point,LineString,LinearRing, Polygon,MultiGeometry,Model --> |
| 39 |
<field name='geometry' type='MFNode' accessType='inputOutput'
appinfo='Shape or (KML) Point LineString LinearRing Polygon MultiGeometry Model'> |
| 40 | <!-- default NULL node --> |
| 41 | </field> |
| 42 |
<field name='diffuseColor' type='SFColor' value='0.2 0.8 0.4' accessType='inputOutput'
appinfo='Default color for PlaceMark'/> |
| 43 | <field name='metadata' type='SFNode' accessType='inputOutput'> |
| 44 | <!-- default NULL node --> |
| 45 | </field> |
| 46 | </ProtoInterface> |
| 47 | <ProtoBody> |
| 48 | <!-- TODO: is Switch needed to choose between balloon and provided geometry, or are both shown? --> |
| 49 |
<!-- ROUTE information for SwitchVisible node:
[from BehaviorScript.visibilityChoice to whichChoice
]
-->
<Switch DEF='SwitchVisible' whichChoice='0'> |
| 50 | <Anchor> |
| 51 | <IS> |
| 52 | <connect nodeField='url' protoField='address'/> |
| 53 | <connect nodeField='description' protoField='description'/> |
| 54 | </IS> |
| 55 | <GeoLocation containerField='children'> |
| 56 | <GeoOrigin> |
| 57 | <IS> |
| 58 | <connect nodeField='geoCoords' protoField='coordinates'/> |
| 59 | </IS> |
| 60 | </GeoOrigin> |
| 61 | </GeoLocation> |
| 62 | <Shape DEF='PlaceMarkBalloon'> |
| 63 | <Extrusion creaseAngle='3.14' crossSection='1.00 0.00 0.92 -0.38 0.71 -0.71 0.38 -0.92 0.00 -1.00 -0.38 -0.92 -0.71 -0.71 -0.92 -0.38 -1.00 -0.00 -0.92 0.38 -0.71 0.71 -0.38 0.92 0.00 1.00 0.38 0.92 0.71 0.71 0.92 0.38 1.00 0.00' scale='0.01 0.01 0.03 0.03 0.06 0.06 0.09 0.09 0.14 0.14 0.23 0.23 0.25 0.25 0.23 0.23 0.18 0.18 0.1 0.1 0.03 0.03' spine='0 0 0 0 0.12 0 0 0.28 0 0 0.4 0 0 0.55 0 0 0.65 0 0 0.75 0 0 0.85 0 0 0.92 0 0 0.98 0 0 1.0 0'/> |
| 64 | <Appearance> |
| 65 |
<!-- Material
PlaceMarkMaterial is a DEF node that has 2 USE nodes: USE_1, USE_2 -->
<Material DEF='PlaceMarkMaterial'> |
| 66 | <IS> |
| 67 | <connect nodeField='diffuseColor' protoField='diffuseColor'/> |
| 68 | </IS> |
| 69 | </Material> |
| 70 | </Appearance> |
| 71 | </Shape> |
| 72 | <Transform DEF='PlaceMarkName' translation='0 1.2 0'> |
| 73 | <Shape> |
| 74 | <Text> |
| 75 | <IS> |
| 76 | <connect nodeField='string' protoField='name'/> |
| 77 | </IS> |
| 78 | <FontStyle justify='"MIDDLE" "MIDDLE"' size='0.2'/> |
| 79 | </Text> |
| 80 | <Appearance> |
| 81 | <Material USE='PlaceMarkMaterial'/> |
| 82 | </Appearance> |
| 83 | </Shape> |
| 84 | </Transform> |
| 85 |
<!-- ROUTE information for SnippetTranslation node:
[from BehaviorScript.snippetOffset to set_translation
]
-->
<Transform DEF='SnippetTranslation' translation='0 2.4 0'> |
| 86 | <Shape> |
| 87 | <Text> |
| 88 | <IS> |
| 89 | <connect nodeField='string' protoField='snippet'/> |
| 90 | </IS> |
| 91 | <FontStyle justify='"MIDDLE" "MIDDLE"' size='0.2'/> |
| 92 | </Text> |
| 93 | <Appearance> |
| 94 | <Material USE='PlaceMarkMaterial'/> |
| 95 | </Appearance> |
| 96 | </Shape> |
| 97 | </Transform> |
| 98 | <Group DEF='GeometryGroup'> |
| 99 | <IS> |
| 100 | <connect nodeField='children' protoField='geometry'/> |
| 101 | </IS> |
| 102 | </Group> |
| 103 | </Anchor> |
| 104 | </Switch> |
| 105 | <!-- remaining nodes in ProtoBody are not rendered --> |
| 106 | <WorldInfo> |
| 107 | <IS> |
| 108 | <connect nodeField='title' protoField='id'/> |
| 109 | </IS> |
| 110 | </WorldInfo> |
| 111 | <Group DEF='MetadataHolderPlaceMark'> |
| 112 | <IS> |
| 113 | <connect nodeField='metadata' protoField='metadata'/> |
| 114 | </IS> |
| 115 | </Group> |
| 116 |
<!-- ROUTE information for BehaviorScript node:
[from visibilityChoice to SwitchVisible.whichChoice
]
[from snippetOffset to SnippetTranslation.set_translation
]
-->
<Script DEF='BehaviorScript'> |
| 117 | <field name='visibility' type='SFBool' accessType='initializeOnly'/> |
| 118 | <field name='set_visibility' type='SFBool' accessType='inputOnly'/> |
| 119 | <field name='visibility_changed' type='SFBool' accessType='outputOnly'/> |
| 120 | <field name='visibilityChoice' type='SFInt32' accessType='outputOnly'/> |
| 121 | <field name='open' type='SFBool' accessType='initializeOnly'/> |
| 122 | <field name='snippet' type='MFString' accessType='initializeOnly'/> |
| 123 | <field name='set_snippet' type='MFString' accessType='inputOnly'/> |
| 124 | <field name='snippet_changed' type='MFString' accessType='outputOnly'/> |
| 125 | <field name='snippetOffset' type='SFVec3f' accessType='outputOnly'/> |
| 126 | <IS> |
| 127 | <connect nodeField='visibility' protoField='visibility'/> |
| 128 | <connect nodeField='set_visibility' protoField='set_visibility'/> |
| 129 | <connect nodeField='visibility_changed' protoField='visibility_changed'/> |
| 130 | <connect nodeField='open' protoField='open'/> |
| 131 | <connect nodeField='snippet' protoField='snippet'/> |
| 132 | <connect nodeField='set_snippet' protoField='set_snippet'/> |
| 133 | <connect nodeField='snippet_changed' protoField='snippet_changed'/> |
| 134 | </IS> |
<![CDATA[
ecmascript:
function initialize ()
{
Browser.println ('visibility=' + visibility);
if (visibility == false) visibilityChoice = -1;
// TODO: if (open == false) open_changed = -1;
adjustSnippetOffset ();
}
function set_visibility (value, timestamp)
{
visibility = value; // remember change
visibility_changed = value; // send eventOut
if (visibility == false) visibilityChoice = -1;
else visibilityChoice = 0;
}
function set_snippet (value, timestamp)
{
snippet = value; // remember change
snippet_changed = value; // send eventOut
adjustSnippetOffset ();
}
function adjustSnippetOffset () // TODO
{
// snippetOffset = new SFVec3f (0.0, (snippet.length * 0.3), 0.0);
// Browser.println ('snippet.length=' + snippet.length + ', snippetOffset=' + snippetOffset);
}
function set_open (value, timestamp) // TODO
{
}
]]>
|
|
| 136 | </Script> |
| 137 | < ROUTE fromNode='BehaviorScript' fromField='visibilityChoice' toNode='SwitchVisible' toField='whichChoice'/> |
| 138 | < ROUTE fromNode='BehaviorScript' fromField='snippetOffset' toNode='SnippetTranslation' toField='set_translation'/> |
| 139 | </ProtoBody> |
| 140 | </ProtoDeclare> |
| 141 | <ProtoDeclare name='Point' appinfo='A geographic location defined by longitude latitude and (required) altitude.' documentation='http://code.google.com/apis/kml/documentation/kml_tags_21.html#point'> |
| 142 | <ProtoInterface> |
| 143 | <field name='id' type='SFString' accessType='initializeOnly'/> |
| 144 |
<field name='altitudeMode' type='SFString' value='clampToGround' accessType='initializeOnly'
appinfo='allowed values: clampToGround relativeToGround absolute'/> |
| 145 | <field name='coordinates' type='SFVec3d' value='0 0 0' accessType='initializeOnly'/> |
| 146 | <field name='set_coordinates' type='SFVec3d' accessType='inputOnly'/> |
| 147 | <field name='coordinates_changed' type='SFVec3d' accessType='outputOnly'/> |
| 148 | <field name='extrude' type='SFBool' value='false' accessType='initializeOnly'/> |
| 149 | <field name='tessellate' type='SFBool' value='false' accessType='initializeOnly'/> |
| 150 | <field name='metadata' type='SFNode' accessType='inputOutput'> |
| 151 | <!-- default NULL node --> |
| 152 | </field> |
| 153 | </ProtoInterface> |
| 154 | <ProtoBody> |
| 155 | <Script DEF='PointScript'> |
| 156 | <field name='altitudeMode' type='SFString' accessType='initializeOnly'/> |
| 157 | <field name='coordinates' type='SFVec3d' accessType='initializeOnly'/> |
| 158 | <field name='set_coordinates' type='SFVec3d' accessType='inputOnly'/> |
| 159 | <field name='coordinates_changed' type='SFVec3d' accessType='outputOnly'/> |
| 160 | <field name='extrude' type='SFBool' accessType='initializeOnly'/> |
| 161 | <field name='tessellate' type='SFBool' accessType='initializeOnly'/> |
| 162 | <IS> |
| 163 | <connect nodeField='altitudeMode' protoField='altitudeMode'/> |
| 164 | <connect nodeField='coordinates' protoField='coordinates'/> |
| 165 | <connect nodeField='set_coordinates' protoField='set_coordinates'/> |
| 166 | <connect nodeField='coordinates_changed' protoField='coordinates_changed'/> |
| 167 | <connect nodeField='extrude' protoField='extrude'/> |
| 168 | <connect nodeField='tessellate' protoField='tessellate'/> |
| 169 | </IS> |
<![CDATA[
ecmascript:
function initialize ()
{
if (altitudeMode == '') altitudeMode = 'clampToGround';
if ((altitudeMode != 'clampToGround') &&
(altitudeMode != 'relativeToGround') &&
(altitudeMode != 'absolute'))
{
warningString = '[Point';
if (id != '') warningString += ' ' + id;
warningString += '] illegal value ';
warningString += 'altitudeMode=' + altitudeMode;
Browser.println (warningString);
}
}
function set_coordinates (value)
{
coordinates = value;
coordinates_changed = value;
}
// TODO: how to handle extrude, tessellate
]]>
|
|
| 171 | </Script> |
| 172 | <WorldInfo> |
| 173 | <IS> |
| 174 | <connect nodeField='title' protoField='id'/> |
| 175 | </IS> |
| 176 | </WorldInfo> |
| 177 | <Group DEF='MetadataHolderPoint'> |
| 178 | <IS> |
| 179 | <connect nodeField='metadata' protoField='metadata'/> |
| 180 | </IS> |
| 181 | </Group> |
| 182 | </ProtoBody> |
| 183 | </ProtoDeclare> |
| 184 | <!-- ========== Examples ========== --> |
| 185 | <Viewpoint description='Placemark example' position='0 0 4'/> |
| 186 | <!-- <?xml version="1.0" encoding="UTF-8"?> <kml "xmlns=http://earth.google.com/kml/2.1>" <Placemark> <name>Simple placemark</name> <description>Attached to the ground. Intelligently places itself at the height of the underlying terrain.</description> <Point> <coordinates>-122.0822035425683,37.42228990140251,0</coordinates> </Point> </Placemark> </kml> --> |
| 187 | <ProtoInstance name='PlaceMark'> |
| 188 | <fieldValue name='name' value='"Simple placemark"'/> |
| 189 | <fieldValue name='description' value='Attached to the ground. Intelligently places itself at the height of the underlying terrain.'/> |
| 190 | <fieldValue name='coordinates' value='-122.0822035425683 37.42228990140251 0'/> |
| 191 | <fieldValue name='address' value='"https://www.web3d.org/x3d-earth"'/> |
| 192 | </ProtoInstance> |
| 193 | </Scene> |
| 194 | </X3D> |
Event Graph ROUTE Table entries with 2 ROUTE connections total, showing X3D event-model relationships for this scene.
Each row shows an event cascade that may occur during a single timestamp interval between frame renderings, as part of the X3D execution model.
|
BehaviorScript
Script visibilityChoice SFInt32 |
SwitchVisible
Switch whichChoice SFInt32 |
|
|
BehaviorScript
Script snippetOffset SFVec3f |
SnippetTranslation
Transform set_translation SFVec3f |
|
PointScript
Script |
No direct ROUTE connection found for events to/from this node. This Script has no direct access to other nodes. |
| line 187
ProtoInstance PlaceMark |
No direct ROUTE connection found for events to/from this node. This ProtoInstance contains SFNode/MFNode fieldValue declarations with direct access to other nodes, and thus has potential to produce run-time animation. |
<!--
Color-coding legend: X3D terminology
<X3dNode
DEF='idName' field='value'/>
matches XML terminology
<XmlElement
DEF='idName' attribute='value'/>
(Light-blue background: event-based behavior node or statement)
(Grey background inside box: inserted documentation)
(Magenta background: X3D Extensibility)
<ProtoInstance name='ProtoName'>
<field
name='fieldName'/> </ProtoInstance>
-->
<!--
For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints.
-->