Package org.locationtech.udig.tools.edit

Examples of org.locationtech.udig.tools.edit.MutualExclusiveBehavior


        activators.add(new GridActivator());
    }

    @Override
    protected void initAcceptBehaviours( List<Behaviour> acceptBehaviours ) {
        MutualExclusiveBehavior mutualExclusive = new MutualExclusiveBehavior();
        acceptBehaviours.add(mutualExclusive);
        mutualExclusive.getBehaviours().add(new AcceptChangesBehaviour(Polygon.class, false){
            @Override
            public boolean isValid( EditToolHandler handler ) {
                SimpleFeature feature = handler.getContext().getEditManager().getEditFeature();
                if (feature == null)
                    return false;
                Geometry geometry = (Geometry) feature.getDefaultGeometry();
                Class< ? extends Geometry> class1 = geometry == null? null : geometry.getClass();
               
                return super.isValid(handler) && feature != null
                        && (class1 == Polygon.class || class1 == MultiPolygon.class);
            }
        });
        mutualExclusive.getBehaviours().add(new AcceptChangesBehaviour(LineString.class, false){
            @Override
            public boolean isValid( EditToolHandler handler ) {
                SimpleFeature feature = handler.getContext().getEditManager().getEditFeature();
                if (feature == null)
                    return false;
                Class< ? extends Geometry> class1 = ((Geometry) feature.getDefaultGeometry())
                        .getClass();
                return super.isValid(handler) && feature != null
                        && (class1 == LineString.class || class1 == MultiLineString.class);
            }
        });
        mutualExclusive.getBehaviours().add(new AcceptChangesBehaviour(Point.class, false){
            @Override
            public boolean isValid( EditToolHandler handler ) {
                SimpleFeature feature = handler.getContext().getEditManager().getEditFeature();
                if (feature == null)
                    return false;
View Full Code Here


        activators.addAll(defaults);
   }

    @Override
    protected void initAcceptBehaviours( List<Behaviour> acceptBehaviours ) {
        MutualExclusiveBehavior mutualExclusive=new MutualExclusiveBehavior();
        acceptBehaviours.add(mutualExclusive);
        mutualExclusive.getBehaviours().add( new AcceptChangesBehaviour(Polygon.class, false){
            @Override
            public boolean isValid( EditToolHandler handler ) {
                SimpleFeature feature = handler.getContext().getEditManager().getEditFeature();
                if( feature==null )
                    return false;
                Class< ? extends Geometry> class1 = ((Geometry)feature.getDefaultGeometry()).getClass();
                return super.isValid(handler) && feature!=null &&
                    (class1==Polygon.class || class1==MultiPolygon.class);
            }
        });
        mutualExclusive.getBehaviours().add( new AcceptChangesBehaviour(LineString.class, false){
            @Override
            public boolean isValid( EditToolHandler handler ) {
                SimpleFeature feature = handler.getContext().getEditManager().getEditFeature();
                if( feature==null )
                    return false;
                Class< ? extends Geometry> class1 = ((Geometry)feature.getDefaultGeometry()).getClass();
                return super.isValid(handler) && feature!=null &&
                    (class1==LineString.class || class1==MultiLineString.class);
            }
        });
        mutualExclusive.getBehaviours().add( new AcceptChangesBehaviour(Point.class, false){
            @Override
            public boolean isValid( EditToolHandler handler ) {
                SimpleFeature feature = handler.getContext().getEditManager().getEditFeature();
                if( feature==null )
                    return false;
View Full Code Here

        activators.add(new ClearCurrentSelectionActivator());
    }

    @Override
    protected void initAcceptBehaviours( List<Behaviour> acceptBehaviours ) {
        MutualExclusiveBehavior mutualExclusive=new MutualExclusiveBehavior();
        acceptBehaviours.add(mutualExclusive);
       
        mutualExclusive.getBehaviours().add( new AcceptChangesBehaviour(Polygon.class, false){
            @Override
            public boolean isValid( EditToolHandler handler ) {
               
                return super.isValid(handler) && handler.getCurrentGeom()!=null &&
                    handler.getCurrentGeom().getShapeType()==ShapeType.POLYGON;
            }
        });
       
        mutualExclusive.getBehaviours().add( new AcceptChangesBehaviour(LineString.class, false){
            @Override
            public boolean isValid( EditToolHandler handler ) {
                return super.isValid(handler&& handler.getCurrentGeom()!=null &&
                handler.getCurrentGeom().getShapeType()==ShapeType.LINE;
            }
View Full Code Here

TOP

Related Classes of org.locationtech.udig.tools.edit.MutualExclusiveBehavior

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.