Revision 29 org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.app/org.gvsig.vectorediting.app.mainplugin/src/main/java/org/gvsig/vectorediting/app/mainplugin/extensions/Circle2PExtension.java
Circle2PExtension.java | ||
---|---|---|
8 | 8 |
|
9 | 9 |
import org.gvsig.andami.IconThemeHelper; |
10 | 10 |
import org.gvsig.app.project.documents.view.gui.DefaultViewPanel; |
11 |
import org.gvsig.fmap.dal.exception.ReadException; |
|
12 |
import org.gvsig.fmap.geom.type.GeometryType; |
|
11 | 13 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
14 |
import org.gvsig.tools.service.ServiceException; |
|
12 | 15 |
import org.gvsig.vectorediting.app.mainplugin.BaseEditingServiceExtension; |
16 |
import org.gvsig.vectorediting.lib.api.EditingServiceInfo; |
|
13 | 17 |
|
18 |
public class Circle2PExtension extends BaseEditingServiceExtension { |
|
14 | 19 |
|
15 |
public class Circle2PExtension extends BaseEditingServiceExtension{ |
|
16 |
|
|
17 | 20 |
public void initialize() { |
18 | 21 |
// TODO Auto-generated method stub |
19 |
|
|
22 |
|
|
20 | 23 |
} |
21 | 24 |
|
22 | 25 |
public void execute(String arg0) { |
... | ... | |
32 | 35 |
} |
33 | 36 |
|
34 | 37 |
public boolean isEnabled() { |
35 |
// TODO Auto-generated method stub |
|
36 |
return true; |
|
38 |
EditingServiceInfo Circle2PInfo; |
|
39 |
try { |
|
40 |
Circle2PInfo = manager.getServiceInfo("Circle2P"); |
|
41 |
DefaultViewPanel view = getActiveView(); |
|
42 |
FLyrVect layer = getActiveLayer(view); |
|
43 |
|
|
44 |
int[] supportedTypes = Circle2PInfo.getSupportedPrimitiveGeometryTypes(); |
|
45 |
GeometryType[] supportedGeoTypes = loadGeometryTypes(supportedTypes); |
|
46 |
|
|
47 |
if (isApplicable(supportedGeoTypes, layer.getShapeType())) { |
|
48 |
return true; |
|
49 |
} |
|
50 |
|
|
51 |
return false; |
|
52 |
|
|
53 |
} |
|
54 |
catch (ServiceException e1) { |
|
55 |
// TODO Auto-generated catch block |
|
56 |
e1.printStackTrace(); |
|
57 |
} |
|
58 |
catch (ReadException e) { |
|
59 |
// TODO Auto-generated catch block |
|
60 |
e.printStackTrace(); |
|
61 |
} |
|
62 |
return false; |
|
37 | 63 |
} |
38 | 64 |
|
39 | 65 |
public boolean isVisible() { |
... | ... | |
47 | 73 |
return false; |
48 | 74 |
} |
49 | 75 |
|
50 |
|
|
51 |
|
|
52 | 76 |
} |
Also available in: Unified diff