@prefix :        <https://www.web3d.org/x3d/content/examples/Savage/Locations/CampPendletonCalifornia/ChartletTranscribed.ttl#> .
@prefix owl:     <http://www.w3.org/2002/07/owl#> .
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema:  <http://schema.org/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix xsd:     <http://www.w3.org/2001/XMLSchema#> .
@prefix x3d:     <https://www.web3d.org/specifications/x3d-4.0.xsd#> .
@prefix x3do:    <https://www.web3d.org/specifications/X3dOntology4.0#> .

:X3D a owl:NamedIndividual, x3do:X3D ;
  x3do:hasHead :head ;
  x3do:hasScene :Scene ;
  x3do:profile 'Immersive' ;
  x3do:version '3.0' ;
  x3do:noNamespaceSchemaLocation 'https://www.web3d.org/specifications/x3d-3.0.xsd' .
:head a owl:NamedIndividual, x3do:head ;
  x3do:hasParent :X3D ;
  x3do:hasMeta :meta_1_1, :meta_1_2, :meta_1_3, :meta_1_4, :meta_1_5, :meta_1_6, :meta_1_7, :meta_1_8 .
:meta_1_1 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'ChartletTranscribed.x3d' ;
  x3do:name 'title' .
:meta_1_2 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'Manually derived bathymetry offshore Camp Pendleton California.' ;
  x3do:name 'description' .
:meta_1_3 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'Don Brutzman and OS3 Bruce Goldin USN' ;
  x3do:name 'creator' .
:meta_1_4 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content '16 March 2001' ;
  x3do:name 'created' .
:meta_1_5 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content '20 October 2019' ;
  x3do:name 'modified' .
:meta_1_6 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'https://www.web3d.org/x3d/content/examples/Savage/Locations/CampPendletonCalifornia/ChartletTranscribed.x3d' ;
  x3do:name 'identifier' .
:meta_1_7 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'X3D-Edit 3.2, https://www.web3d.org/x3d/tools/X3D-Edit' ;
  x3do:name 'generator' .
:meta_1_8 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content '../../license.html' ;
  x3do:name 'license' .
:meta dcterms:title "ChartletTranscribed.x3d" .
:meta dcterms:description "Manually derived bathymetry offshore Camp Pendleton California." .
:meta dcterms:creator "Don Brutzman and OS3 Bruce Goldin USN" .
:meta dcterms:created "16 March 2001" .
:meta dcterms:modified "20 October 2019" .
:meta dcterms:identifier "https://www.web3d.org/x3d/content/examples/Savage/Locations/CampPendletonCalifornia/ChartletTranscribed.x3d" .
:meta dcterms:generator "X3D-Edit 3.2, https://www.web3d.org/x3d/tools/X3D-Edit" .
:meta dcterms:license "../../license.html" .
:Scene a owl:NamedIndividual, x3do:Scene ;
  x3do:hasParent :X3D ;
  x3do:hasChildren :WorldInfo_2_1, :Background_2_2, :DirectionalLight_2_3, :NavigationInfo_2_4, :Transform_2_5, :Switch_2_6 ;
  x3do:hasROUTE :ROUTE_2_7, :ROUTE_2_8 .
:WorldInfo_2_1 a owl:NamedIndividual, x3do:WorldInfo ;
  x3do:hasParent :Scene ;
  x3do:title 'ChartletTranscribed.x3d' .
:Background_2_2 a owl:NamedIndividual, x3do:Background ;
  x3do:hasParent :Scene ;
  x3do:groundColor ( 0.2 0.2 0.5 ) ;
  x3do:skyColor ( 0.4 0.4 1 ) .
:DirectionalLight_2_3 a owl:NamedIndividual, x3do:DirectionalLight ;
  x3do:hasParent :Scene ;
  x3do:direction ( 0 -1 0 ) .
:NavigationInfo_2_4 a owl:NamedIndividual, x3do:NavigationInfo ;
  x3do:hasParent :Scene ;
  x3do:speed 100 ;
  x3do:type '"EXAMINE" "WALK" "FLY" "ANY"' .
:Transform_2_5 a owl:NamedIndividual, x3do:Transform ;
  x3do:hasParent :Scene ;
  x3do:hasChildren :Viewpoint_2_5_1 ;
  x3do:rotation ( 0 1 0 -1.57 ) ;
  x3do:translation ( -2000 1000 2464 ) .
:Viewpoint_2_5_1 a owl:NamedIndividual, x3do:Viewpoint ;
  x3do:hasParent :Transform_2_5 ;
  x3do:description 'Chartlet view' ;
  x3do:orientation ( 1 0 0 -0.3 ) .
:Switch_2_6 a owl:NamedIndividual, x3do:Switch ;
  x3do:hasParent :Scene ;
  x3do:hasChildren :Group_2_6_1 ;
  x3do:whichChoice 0 .
:Group_2_6_1 a owl:NamedIndividual, x3do:Group ;
  x3do:hasParent :Switch_2_6 ;
  x3do:hasChildren :Transform_2_6_1_1, :Transform_2_6_1_2, :Transform_2_6_1_3 .
:Transform_2_6_1_1 a owl:NamedIndividual, x3do:Transform ;
  x3do:hasParent :Group_2_6_1 ;
  x3do:hasChildren :Shape_2_6_1_1_1, :CalculateColorSchemeMEDAL ;
  x3do:scale ( 1 3.275 1 ) .
:Shape_2_6_1_1_1 a owl:NamedIndividual, x3do:Shape ;
  x3do:hasParent :Transform_2_6_1_1 ;
  x3do:hasGeometry :BathymetryGrid ;
  x3do:hasAppearance :Appearance_2_6_1_1_1_2 .
:BathymetryGrid a owl:NamedIndividual, x3do:ElevationGrid ;
  x3do:hasParent :Shape_2_6_1_1_1 ;
  x3do:hasColor :BathymetryGridColorNodeCalculated ;
  x3do:DEF 'BathymetryGrid' ;
  x3do:creaseAngle 3.14 ;
  x3do:solid false ;
  x3do:xDimension 31 ;
  x3do:xSpacing 154 ;
  x3do:zDimension 29 ;
  x3do:zSpacing 184 .
:BathymetryGridColorNodeCalculated a owl:NamedIndividual, x3do:Color ;
  x3do:hasParent :BathymetryGrid ;
  x3do:DEF 'BathymetryGridColorNodeCalculated' ;
  x3do:color ( 0 0 0 ) .
:Appearance_2_6_1_1_1_2 a owl:NamedIndividual, x3do:Appearance ;
  x3do:hasParent :Shape_2_6_1_1_1 ;
  x3do:hasMaterial :Material_2_6_1_1_1_2_1 .
:Material_2_6_1_1_1_2_1 a owl:NamedIndividual, x3do:Material ;
  x3do:hasParent :Appearance_2_6_1_1_1_2 ;
  x3do:diffuseColor ( 0 0 0.25 ) .
:CalculateColorSchemeMEDAL a owl:NamedIndividual, x3do:Script ;
  x3do:hasParent :Transform_2_6_1_1 ;
  x3do:hasField :field_2_6_1_1_2_1, :field_2_6_1_1_2_2, :field_2_6_1_1_2_3, :field_2_6_1_1_2_4 ;
  x3do:DEF 'CalculateColorSchemeMEDAL' ;
  x3do:sourceCode """
ecmascript:

function initialize ()
{
	totalHeights=heightValues.length;
	heightValuesHold = new MFFloat (0);
//	Browser.println ('totalHeights=heightValues.length=' + totalHeights);

  // this depth band defined to match fathoms to 60 feet, then 10' increments, doesn't match MEDAL
  depthBand = new MFFloat (0,-6,-12,-18,-24,-30,-36,-42,-48,-54,-60,-70,-80,-90,-100);

  if (inputUnits == 'feet')
  {
	for ( index = 1; index <= totalHeights ; index++ )
	{
		// 1 meter = 39.3 inches
		heightValuesHold[index] = heightValues[index] * (12.0 / 39.3);
	}
	heightValuesOutput = heightValuesHold;
  }
  else
  {
	for ( index = 1; index <= depthBand.length ; index++ )
	{
		// 1 meter = 39.3 inches
		depthBand[index] *= (39.31 / 2.0);
	}
	heightValuesOutput = heightValues;
  }
  brown		= new SFColor (0.2, 0.2, 0);
  white		= new SFColor (1, 1, 1);
  red		= new SFColor (1, 0, 0);
  orange	= new SFColor (1, .529, 0);
  yellow	= new SFColor (1, 1, 0);
  green		= new SFColor (0, 1, 0);
  cyan		= new SFColor (0, 1, 1);
  blue		= new SFColor (0, 0, 1);
  magenta	= new SFColor (1, 0, 1);
  maroon	= new SFColor (0.561, 0, 0.322);
  tan		= new SFColor (0.871, 0.721, 0.529);
  seaGreen	= new SFColor (0.322, 0.584, 0.517);
  slateBlue	= new SFColor (0.494, 0.533, 0.671);
  navyBlue	= new SFColor (0.137, 0.137, 0.459);
  grey		= new SFColor (0.5,   0.5,   0.5);
  slateGrey	= new SFColor (0.439, 0.502, 0.565);
  skyBlue	= new SFColor (0.6, 0.6, 1.0);
  olive		= new SFColor (0.1, 0.4, 0);
  black		= new SFColor (0.1, 0.1, 0.1);

  colorValuesOutput = new MFColor (); // array gets dynamically expanded
  for ( index = 1; index <= totalHeights ; index++ )
  {
	if      (heightValues[index] > depthBand[1])  colorValuesOutput [index] = brown;
	else if (heightValues[index] > depthBand[2])  colorValuesOutput [index] = cyan;
	else if (heightValues[index] > depthBand[3])  colorValuesOutput [index] = red;
	else if (heightValues[index] > depthBand[4])  colorValuesOutput [index] = orange;
	else if (heightValues[index] > depthBand[5])  colorValuesOutput [index] = yellow;
	else if (heightValues[index] > depthBand[6])  colorValuesOutput [index] = tan;
	else if (heightValues[index] > depthBand[7])  colorValuesOutput [index] = grey;
	else if (heightValues[index] > depthBand[8])  colorValuesOutput [index] = olive;
	else if (heightValues[index] > depthBand[9])  colorValuesOutput [index] = green;
	else if (heightValues[index] > depthBand[10]) colorValuesOutput [index] = seaGreen;
	else if (heightValues[index] > depthBand[11]) colorValuesOutput [index] = navyBlue;
	else if (heightValues[index] > depthBand[12]) colorValuesOutput [index] = blue;
	else if (heightValues[index] > depthBand[13]) colorValuesOutput [index] = slateBlue;
	else if (heightValues[index] > depthBand[14]) colorValuesOutput [index] = skyBlue;
	else if (heightValues[index] > depthBand[15]) colorValuesOutput [index] = slateGrey;
	else                                          colorValuesOutput [index] = black;

//	if      (heightValues[index] > depthBand[1])  colorValuesOutput [index] = brown;
//	else if (heightValues[index] > depthBand[2])  colorValuesOutput [index] = yellow;
//	else if (heightValues[index] > depthBand[3])  colorValuesOutput [index] = green;
//	else if (heightValues[index] > depthBand[4])  colorValuesOutput [index] = cyan;
//	else if (heightValues[index] > depthBand[5])  colorValuesOutput [index] = magenta;
//	else if (heightValues[index] > depthBand[6])  colorValuesOutput [index] = tan;
//	else if (heightValues[index] > depthBand[7])  colorValuesOutput [index] = skyBlue;
//	else if (heightValues[index] > depthBand[8])  colorValuesOutput [index] = red;
//	else if (heightValues[index] > depthBand[9])  colorValuesOutput [index] = grey;
//	else if (heightValues[index] > depthBand[10]) colorValuesOutput [index] = seaGreen;
//	else if (heightValues[index] > depthBand[11]) colorValuesOutput [index] = slateBlue;
//	else if (heightValues[index] > depthBand[12]) colorValuesOutput [index] = olive;
//	else if (heightValues[index] > depthBand[13]) colorValuesOutput [index] = black;
//	else if (heightValues[index] > depthBand[14]) colorValuesOutput [index] = navyBlue;
//	else if (heightValues[index] > depthBand[15]) colorValuesOutput [index] = slateGrey;
//	else                                          colorValuesOutput [index] = orange;
  }
}
""" .
:field_2_6_1_1_2_1 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :CalculateColorSchemeMEDAL ;
  x3do:accessType 'initializeOnly' ;
  x3do:name 'inputUnits' ;
  x3do:type 'SFString' ;
  x3do:value 'feet' .
:field_2_6_1_1_2_2 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :CalculateColorSchemeMEDAL ;
  x3do:accessType 'initializeOnly' ;
  x3do:name 'heightValues' ;
  x3do:type 'MFFloat' ;
  x3do:value ( -101 -90 -84 -78 -72 -72 -70 -65 -62 -63 -55 -53 -50 -50 -47 -45 -45 -43 -42 -41 -38 -37 -37 -36 -34 -31 -31 -27 -26 -25 -23 -101 -90 -84 -78 -72 -72 -66 -66 -64 -58 -55 -53 -50 -48 -46 -45 -43 -42 -42 -39 -39 -37 -36 -34 -32 -31 -27 -26 -21 -24 -19 -86 -84 -78 -73 -72 -66 -66 -61 -57 -55 -52 -49 -48 -46 -45 -46 -45 -38 -38 -36 -33 -32 -32 -31 -30 -30 -25 -24 -22 -15 -9 -84 -78 -75 -72 -66 -65 -63 -58 -55 -53 -49 -47 -47 -45 -43 -42 -40 -39 -37.5 -35.5 -34 -32.5 -31 -32 -28 -26 -24 -21 -20 -8.5 -5 -79 -72 -70 -66 -66 -60 -57 -54 -52 -49 -48 -46 -44 -43 -43 -40 -40 -39 -36 -34 -33 -32 -31 -28 -26 -24 -22 -20 -10 -5 0 -81 -72 -66 -63 -60 -58 -57 -54 -51 -49 -46 -46 -44 -42 -41 -40 -40 -41 -35.5 -35 -33 -31 -28 -27 -25 -23 -18 -13 -5 0 0 -72 -66 -64.5 -60 -59 -55 -54 -52 -48 -48 -45 -44 -42 -42 -41 -40 -39.5 -38 -36 -35 -34 -29 -28 -24 -23 -18 -12 -5 0 0 0 -70 -65 -62 -61 -54 -54 -51 -49 -48 -45 -45 -44 -43 -40 -39.7 -39 -38 -35 -34 -33 -31 -28.7 -26 -23 -19 -14 -5 0 0 0 0 -63 -61 -60 -55 -54 -51 -50 -50 -47 -44 -43 -41 -39 -38 -37 -36 -36 -36 -33 -33 -31 -27 -24 -19 -12 -5 0 0 0 0 0 -60 -59 -55 -53 -50 -50 -49 -48 -45 -44 -41 -39.5 -39 -37 -36.5 -36 -34 -34 -32 -30.5 -29 -27 -20 -15 -8 -2 0 0 0 0 0 -58 -56.5 -54 -50 -50 -49 -48 -47 -44 -42 -39 -38.5 -37 -36 -36 -29.7 -33 -32 -31 -29 -27.7 -22 -16 -9 -2 0 0 0 0 0 0 -55 -53 -50 -49 -48 -47 -43 -44 -44 -40 -39 -38 -37 -36 -34 -33.5 -31 -30 -27.5 -26 -23 -17 -11 -2 0 0 0 0 0 0 0 -54 -51 -50 -47 -47 -47 -45 -45 -43 -41 -39 -37 -36 -35 -33 -32 -30 -29 -27 -24.5 -21 -15 -5 0 0 0 0 0 0 0 0 -53 -51 -48 -46 -44 -44.5 -43 -42 -41 -40 -36.5 -35 -34.5 -35 -18 -31 -29 -26 -24 -20 -13 -5 0 0 0 0 0 0 0 0 0 -52 -50 -47 -45 -44 -44 -43 -42 -40 -38 -36.5 -34 -32.5 -31 -31 -29.5 -26.7 -24.5 -20 -13 -7 0 0 0 0 0 0 0 0 0 0 -49.5 -49 -47 -45 -43 -41.5 -40 -39.5 -37.5 -34 -34 -33 -33 -32 -28.5 -28 -26 -21 -15 -8 -1 0 0 0 0 0 0 0 0 0 0 -49 -48 -46 -46 -44 -40 -41 -38.5 -37 -37 -36.5 -33 -32.5 -30 -27 -26 -22 -14 -10 -1 0 0 0 0 0 0 0 0 0 0 0 -47 -46 -45 -45 -44 -41 -40 -38 -37 -34 -33 -32.5 -31 -28.7 -26 -22 -19 -10 -3 0 0 0 0 0 0 0 0 0 0 0 0 -45 -44.5 -42 -42 -42 -40 -39 -37.5 -36 -32.5 -31 -31 -29 -26 -23 -20 -10 -5 0 0 0 0 0 0 0 0 0 0 0 0 0 -44 -45 -40 -40 -39 -38 -37.5 -35 -33 -31.5 -30 -29 -26 -24 -20 -12 -6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -43 -41 -39.5 -39 -38 -36 -35 -32 -32 -30 -28 -27 -24 -20 -12 -5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -40 -39 -39 -39 -36 -34 -32 -31 -30 -27 -26 -24 -20 -12 -5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -39 -38.5 -38 -38 -34 -33 -31 -30 -27 -25 -24 -21 -13 -6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -38 -37 -36.5 -34 -32 -31 -29.7 -28 -26 -24 -20.5 -14 -7 -2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -37 -37 -33.8 -33 -31 -29 -28.5 -26.7 -25.5 -20 -14 -7 -2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -34 -39 -33 -31 -29 -27 -27 -24 -21 -16 -7 -2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -34 -36 -33 -30 -28 -26 -26 -22 -15 -8 -2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -32 -32 -29 -27.5 -25.7 -25 -23 -15 -8 -2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -33 -30 -27 -26 -24 -21 -16 -9 -2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ) .
:field_2_6_1_1_2_3 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :CalculateColorSchemeMEDAL ;
  x3do:accessType 'outputOnly' ;
  x3do:name 'heightValuesOutput' ;
  x3do:type 'MFFloat' .
:field_2_6_1_1_2_4 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :CalculateColorSchemeMEDAL ;
  x3do:accessType 'outputOnly' ;
  x3do:name 'colorValuesOutput' ;
  x3do:type 'MFColor' .
:Transform_2_6_1_2 a owl:NamedIndividual, x3do:Transform ;
  x3do:hasParent :Group_2_6_1 ;
  x3do:hasChildren :GridXZ_20x20Fixed ;
  x3do:scale ( 250 250 250 ) ;
  x3do:translation ( 2500 0 2500 ) .
:GridXZ_20x20Fixed a owl:NamedIndividual, x3do:Inline ;
  x3do:hasParent :Transform_2_6_1_2 ;
  x3do:DEF 'GridXZ_20x20Fixed' ;
  x3do:url '"../../../Savage/Tools/Authoring/GridXZ_20x20Fixed.x3d" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Authoring/GridXZ_20x20Fixed.x3d" "../../../Savage/Tools/Authoring/GridXZ_20x20Fixed.wrl" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Authoring/GridXZ_20x20Fixed.wrl"' .
:Transform_2_6_1_3 a owl:NamedIndividual, x3do:Transform ;
  x3do:hasParent :Group_2_6_1 ;
  x3do:hasChildren :CoordinateAxes ;
  x3do:scale ( 1000 1000 1000 ) .
:CoordinateAxes a owl:NamedIndividual, x3do:Inline ;
  x3do:hasParent :Transform_2_6_1_3 ;
  x3do:DEF 'CoordinateAxes' ;
  x3do:url '"../../../Savage/Tools/Authoring/CoordinateAxes.x3d" "../../../X3dForWebAuthors/Chapter03Grouping/CoordinateAxes.x3d" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Authoring/CoordinateAxes.x3d" "https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter03Grouping/CoordinateAxes.x3d" "../../../Savage/Tools/Authoring/CoordinateAxes.wrl" "../../../X3dForWebAuthors/Chapter03Grouping/CoordinateAxes.wrl" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Authoring/CoordinateAxes.wrl" "https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter03Grouping/CoordinateAxes.wrl"' .
:ROUTE_2_7 a owl:NamedIndividual, x3do:ROUTE ;
  x3do:hasParent :Scene ;
  x3do:fromField 'heightValuesOutput' ;
  x3do:fromNode 'CalculateColorSchemeMEDAL' ;
  x3do:toField 'set_height' ;
  x3do:toNode 'BathymetryGrid' .
:ROUTE_2_8 a owl:NamedIndividual, x3do:ROUTE ;
  x3do:hasParent :Scene ;
  x3do:fromField 'colorValuesOutput' ;
  x3do:fromNode 'CalculateColorSchemeMEDAL' ;
  x3do:toField 'set_color' ;
  x3do:toNode 'BathymetryGridColorNodeCalculated' .
