Revision 44025
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/ProjectSymbolTable.java | ||
---|---|---|
9 | 9 |
import org.apache.commons.io.IOUtils; |
10 | 10 |
import org.apache.commons.lang3.Range; |
11 | 11 |
import org.cresques.cts.IProjection; |
12 |
import org.gvsig.app.ApplicationLocator; |
|
13 |
import org.gvsig.app.ApplicationManager; |
|
12 | 14 |
import org.gvsig.app.project.documents.Document; |
13 | 15 |
import org.gvsig.app.project.documents.view.ViewDocument; |
14 | 16 |
import org.gvsig.app.project.documents.view.ViewManager; |
... | ... | |
24 | 26 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
25 | 27 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
26 | 28 |
import org.gvsig.fmap.geom.Geometry; |
29 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
27 | 30 |
import org.gvsig.fmap.mapcontext.MapContext; |
28 | 31 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
29 | 32 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
... | ... | |
66 | 69 |
|
67 | 70 |
} |
68 | 71 |
|
72 |
private class CurrentViewValue extends CachedValue<ViewDocument> { |
|
73 |
|
|
74 |
@Override |
|
75 |
protected void reload() { |
|
76 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
77 |
ViewDocument viewdoc = (ViewDocument) application.getActiveDocument(ViewManager.TYPENAME); |
|
78 |
value = viewdoc; |
|
79 |
} |
|
80 |
|
|
81 |
} |
|
82 |
|
|
83 |
private class CurrentViewEnvelopeValue extends CachedValue<Geometry> { |
|
84 |
|
|
85 |
@Override |
|
86 |
protected void reload() { |
|
87 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
88 |
ViewDocument viewdoc = (ViewDocument) application.getActiveDocument(ViewManager.TYPENAME); |
|
89 |
if( viewdoc == null ) { |
|
90 |
value = null; |
|
91 |
return; |
|
92 |
} |
|
93 |
value = viewdoc.getMapContext().getViewPort().getEnvelope().getGeometry(); |
|
94 |
} |
|
95 |
|
|
96 |
} |
|
97 |
|
|
69 | 98 |
private class PropertiesValue extends CachedValue<Map<File, Properties>> { |
70 | 99 |
|
71 | 100 |
@Override |
... | ... | |
261 | 290 |
|
262 | 291 |
} |
263 | 292 |
|
293 |
private class ViewBBoxFunction extends AbstractFunction { |
|
294 |
|
|
295 |
public ViewBBoxFunction() { |
|
296 |
super( |
|
297 |
"Project", |
|
298 |
"viewbbox", |
|
299 |
Range.is(0), |
|
300 |
"Return the BBox of the active view.", |
|
301 |
"viewbbox()", |
|
302 |
null, |
|
303 |
"Geometry" |
|
304 |
); |
|
305 |
} |
|
306 |
|
|
307 |
@Override |
|
308 |
public Object call(Interpreter interpreter, Object[] args) throws Exception { |
|
309 |
return currentViewEnvelope.get(); |
|
310 |
} |
|
311 |
|
|
312 |
} |
|
313 |
|
|
264 | 314 |
private class AreaFunction extends AbstractFunction { |
265 | 315 |
|
266 | 316 |
public AreaFunction() { |
... | ... | |
401 | 451 |
} |
402 | 452 |
|
403 | 453 |
ProjectValue currentProject = new ProjectValue(); |
454 |
CurrentViewValue currentView = new CurrentViewValue(); |
|
455 |
CurrentViewEnvelopeValue currentViewEnvelope = new CurrentViewEnvelopeValue(); |
|
404 | 456 |
PropertiesValue propertiesFiles = new PropertiesValue(); |
405 | 457 |
|
406 | 458 |
@SuppressWarnings("OverridableMethodCallInConstructor") |
... | ... | |
410 | 462 |
this.addFunction(new FirstSelectedFeatureFunction()); |
411 | 463 |
this.addFunction(new FirstFeatureFunction()); |
412 | 464 |
this.addFunction(new ViewFunction()); |
465 |
this.addFunction(new ViewBBoxFunction()); |
|
413 | 466 |
this.addFunction(new PropertyFunction()); |
414 | 467 |
this.addFunction(new AreaFunction()); |
415 | 468 |
this.addFunction(new PerimeterFunction()); |
Also available in: Unified diff