PageSourceSearch

https://polardata.ca/pdcsearch/js/footprints_functions.js

js polardata.ca collected 2026-10-02 07:09:11 UTC 6,628 bytes, 198 lines download raw bytes

1/*Author: Freddy Paya 
2Date: June 25 2013
3Functions to activate/deactivate footprints views on the map/search form  
4*/
5
6//Called when hover over a footprint
7function goSelectTableRowAndMapPoly(ID) {
8	// only if it is in the active page
9	if (document.getElementById(ID) != null )
10		{
11		/*** Kumari May 28 2013 some code that was experimented to find ext js row from ID ***/
12		//var resultStore = Ext.getCmp('PDCgrid').getStore();
13		//var record = resultStore.getNodeById(ID),
14	   // rowIndex = resultStore.indexOf(record);
15		//selRow = Ext.getCmp('PDCgrid').getView().getRow(rowIndex);
16		//Ext.get(selRow).setStyle('backgroundColor', 'lightsteelblue');
17			document.getElementById(ID).className = "shover_button";
18		}
19  	parent.selectStyleFeatureClr(ID);
20  }
21
22//Called when unhover over a footprint
23function goDefaultTableRowAndMapPoly(ID) {
24	// only if it is in the active page
25	if (document.getElementById(ID) != null )
26		{
27			document.getElementById(ID).className = "sh_button"; //default
28		}
29  	parent.defaultStyleFeatureClr(ID);
30  	}
31
32
33//Called when Show/Hide button is pressed
34function showHideButton(ID, CID, footprint,rowIndex) {
35	
36	var n = parent.getActiveMapNumber();
37	if (n != 0 && n != 1) {
38		//may never occur - but nevetheless good to have catch for exceptions!
39		//alert("Error displaying on foot print. Please email error report to [email protected]");
40		//hovering/clicking over/on show/hide button on gis tab
41		//alert("Please select Arctic or Antartic to view the footprint of the data");
42		Ext.MessageBox.alert('Search Error', 'Please select the Arctic or Antarctic tab to view the footprint of the data');
43		return;
44	}  
45	if (document.getElementById(ID).value == "Show") {
46		document.getElementById(ID).value = "Hide";
47		document.getElementById(ID).className = "sh_button"; //default
48		parent.pushSelectionValues(ID,footprint);
49		cell = Ext.getCmp('PDCgrid').getView().getCell(rowIndex, 3);
50		Ext.get(cell).setStyle('backgroundColor', 'lightsteelblue');
51		parent.selectStyleFeatureClr(ID);
52		
53	} else if (document.getElementById(ID).value == "Hide") {
54		parent.removeSelectionFromArray(ID);
55		document.getElementById(ID).value = "Show";
56		document.getElementById(ID).className = "sh_button"; //default
57		cell = Ext.getCmp('PDCgrid').getView().getCell(rowIndex, 3);
58		Ext.get(cell).setStyle('backgroundColor', 'transparent');
59	}
60}
61
62function highlightSelectedFootprint(ID) {
63	var n = parent.getActiveMapNumber();
64	   // Check if this footprint exists, if it exists,remove it
65		if (parent.resultsIdArrays[n].length > 0) {
66			for (var position = 0; position < parent.resultsIdArrays[n].length; position ++) {
67				if (parent.resultsIdArrays[n][position] == ID) {
68					goSelectTableRowAndMapPoly(parent.resultsIdArrays[n][position]);
69					break;
70				}
71			}
72		}
73}
74
75function defaultSelectedFootprint(ID) {
76	var n = parent.getActiveMapNumber();
77	   // Check if this footprint exists, if it exists,remove it
78		if (parent.resultsIdArrays[n].length > 0) {
79			for (var position = 0; position < parent.resultsIdArrays[n].length; position ++) {
80				if (parent.resultsIdArrays[n][position] == ID) {
81					goDefaultTableRowAndMapPoly(parent.resultsIdArrays[n][position]);
82					break;
83				}
84			}
85		}
86} 
87//Hides all footprints from map
88 function hideAllFootprints() {
89	 parent.removeAllFootPrints();
90	 var input_list = document.getElementsByTagName("input");
91	 // find id of all rows with value of "Hide"
92	 for(var i=0; i < input_list.length; i++) {
93		 var node = input_list[i];
94         if(node.getAttribute('type')=='button') {
95        	 if(node.value=='Hide') {
96        	 	 cell = Ext.getCmp('PDCgrid').getView().getCell(i-1, 3);
97        		 Ext.get(cell).setStyle('backgroundColor', 'transparent');
98         		document.getElementById(node.id).value = "Show";
99            }
100         }
101	 }                  
102}	
103 
104//Called when mouse over a footprint
105 function onFeatureSelect(feature) {
106 	var n = getActiveMapNumber();
107 	var searchResults = results;
108 	var pos = 0;
109
110 	// Check if this feature exists
111 	for (var j = 0; j < resultsIdArrays[n].length; j ++) {
112 		if (resultsMarkerArrays[n][j] == feature) {
113 			pos = j;
114 			searchResults.goSelectTableRowAndMapPoly(resultsIdArrays[n][pos]);
115 			break;
116 		}
117 	}
118
119 }
120
121 //Called when mouse out a footprint
122 function onFeatureUnselect(feature) {
123 	var searchResults = results;
124 	var n = getActiveMapNumber();
125 	
126 	var pos = 0;
127 	// Check if this feature exists
128 	for (var j = 0; j < resultsIdArrays[n].length; j ++) {
129 		if (resultsMarkerArrays[n][j] == feature) {
130 			pos = j;
131 			searchResults.goDefaultTableRowAndMapPoly(resultsIdArrays[n][pos]);
132 			break;
133 		}
134 	}
135
136 }
137
138 /// Highlight the footprint on the map
139 function selectStyleFeatureClr(ID) {
140    var n = getActiveMapNumber();
141    var pos = -1; 
142
143    // Check if this footprint exists
144 	for (var i = 0; i < resultsIdArrays[n].length; i ++) {
145 		if (resultsIdArrays[n][i] == ID) {
146 			pos = i;
147 			resultsLayers[n].drawFeature(resultsVectorArrays[n][pos], select_style);
148 			resultsLayers[n].drawFeature(resultsMarkerArrays[n][pos], resultsMarkerSelectStyle);
149 			break;
150 		}
151 	}
152 	
153 }
154
155 //Unhighlight the footprint on the map
156 function defaultStyleFeatureClr(ID) {
157    var n = getActiveMapNumber();
158       // Check if this footprint exists, if it exists, unhighlight the footprint and the marker
159 	for (var i = 0; i < resultsIdArrays[n].length; i ++) {
160 		if (resultsIdArrays[n][i] == ID) {
161 			resultsLayers[n].drawFeature(resultsVectorArrays[n][i], default_style);
162 			resultsLayers[n].drawFeature(resultsMarkerArrays[n][i], resultsMarkerDefaultStyle);
163 			break;
164 		}
165 	}
166 }
167//Remove all footprints 
168 function removeAllFootPrints() {
169    //var n = getActiveMapNumber();
170    // Check if this footprint exists, if it exists,remove it
171    numOfArcticFootPrints = resultsIdArrays[0].length;
172    numOfAntarticFootPrints = resultsIdArrays[1].length;
173 	if (numOfArcticFootPrints > 0) 
174 	{
175 		for (var position = 0; position < numOfArcticFootPrints; position++) 
176 		{
177 				resultsLayers[0].removeFeatures([resultsVectorArrays[0][position]]);
178 				resultsLayers[0].removeFeatures([resultsMarkerArrays[0][position]]);
179 		}
180 		resultsIdArrays[0].length = 0;
181 		resultsVectorArrays[0].length = 0;
182 		resultsMarkerArrays[0].length = 0;
183
184 	}
185 	
186 	if (numOfAntarticFootPrints > 0) 
187 	{
188 		for (var position = 0; position < numOfAntarticFootPrints; position++) 
189 		{
190 				resultsLayers[1].removeFeatures([resultsVectorArrays[1][position]]);
191 				resultsLayers[1].removeFeatures([resultsMarkerArrays[1][position]]);
192 		}
193 		resultsIdArrays[1].length = 0;
194 		resultsVectorArrays[1].length = 0;
195 		resultsMarkerArrays[1].length = 0;
196 	}
197 }
198	

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.