1 |
3032
|
perry
|
/*
|
2 |
|
|
License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
|
3 |
|
|
$Id$
|
4 |
|
|
*/
|
5 |
|
|
mapbuilder.loadScript(baseDir+"/widget/Popup.js");
|
6 |
|
|
mapbuilder.loadScript(baseDir+"/widget/FeaturePointFactory.js");
|
7 |
|
|
|
8 |
|
|
/**
|
9 |
|
|
* Feature Facctoty constructor
|
10 |
|
|
* @param widgetNode The widget's XML object node from the configuration document.
|
11 |
|
|
* @param model The model object that this widget belongs to.
|
12 |
|
|
*/
|
13 |
|
|
function FeatureFactory(widgetNode, model) {
|
14 |
|
|
// initialize popu capability
|
15 |
|
|
this.popup = new Popup( widgetNode, model );
|
16 |
|
|
|
17 |
|
|
// init the derived factories
|
18 |
|
|
this.featurePointFactory = new FeaturePointFactory( widgetNode, model );
|
19 |
|
|
}
|
20 |
|
|
|
21 |
|
|
/**
|
22 |
|
|
* clear all created features
|
23 |
|
|
*/
|
24 |
|
|
FeatureFactory.prototype.clearFeatures = function( ) {
|
25 |
|
|
// that's all we have implemented so far
|
26 |
|
|
this.featurePointFactory.clearPointFeatures();
|
27 |
|
|
}
|
28 |
|
|
|
29 |
|
|
/**
|
30 |
|
|
* Feature Factory that will create a feature of proper type
|
31 |
|
|
* @param objRef a pointer to this widget object
|
32 |
|
|
* @param type Feature type to render: POINT, LINE, CURVE, POLY
|
33 |
|
|
* @param geometry array of necessary coordinates for that type of geometry
|
34 |
|
|
* @param itemId feature Id
|
35 |
|
|
* @param title title of feature
|
36 |
|
|
* @param papupStr popup to display on mouseover
|
37 |
|
|
*/
|
38 |
|
|
FeatureFactory.prototype.createFeature = function( objRef, type, geometry, itemId, title, popupStr ) {
|
39 |
|
|
if( type == 'POINT' ) {
|
40 |
|
|
this.featurePointFactory.createPointFeature( objRef, geometry, itemId, title, popupStr );
|
41 |
|
|
} else if( type == 'LINE' ) {
|
42 |
|
|
// this will probably require a round trip to server to generate the line
|
43 |
|
|
} else if( type == 'CURVE' ) {
|
44 |
|
|
// this will probably require a round trip to server to generate the bezier curve
|
45 |
|
|
} else if( type == 'POLY' ) {
|
46 |
|
|
// this will probably require a round trip to server to generate the poly
|
47 |
|
|
} else {
|
48 |
|
|
alert( 'feature:'+type+' is not supported');
|
49 |
|
|
}
|
50 |
|
|
}
|