Package org.locationtech.udig.project.ui.render.displayAdapter

Examples of org.locationtech.udig.project.ui.render.displayAdapter.MapMouseEvent


       
        assertNotNull( handler.getContext().getEditManager().getEditFeature());

        handler.getAcceptBehaviours().add(new AcceptChangesBehaviour(Polygon.class, false));
        handler.getMouseTracker().setDragStarted(Point.valueOf(10,0));
        MapMouseEvent event=new MapMouseEvent( null, 20, 20, MapMouseEvent.NONE,
                MapMouseEvent.BUTTON1, MapMouseEvent.BUTTON1);
        handler.handleEvent(event, EventType.DRAGGED);
       
        assertTrue( handler.isLocked() );
        assertTrue( handler.isLockOwner(behav) );

        event=new MapMouseEvent( null, 20, 20, MapMouseEvent.NONE,
                MapMouseEvent.NONE, MapMouseEvent.BUTTON1);
        handler.setTesting(false);
        handler.handleEvent(event, EventType.RELEASED);

        UDIGTestUtil.inDisplayThreadWait(1000, new WaitCondition(){
View Full Code Here


       
        handler.getBehaviours().add(behav);
       
        handler.getAcceptBehaviours().add(new AcceptChangesBehaviour(Polygon.class, false));
        handler.getMouseTracker().setDragStarted(Point.valueOf(10,0));
        MapMouseEvent event=new MapMouseEvent( null, 26, 16, MapMouseEvent.NONE,
                MapMouseEvent.BUTTON1, MapMouseEvent.BUTTON1);
        handler.handleEvent(event, EventType.DRAGGED);
       
        assertTrue( handler.isLocked() );
        assertTrue( handler.isLockOwner(behav) );

        event=new MapMouseEvent( null, 26, 16, MapMouseEvent.NONE,
                MapMouseEvent.NONE, MapMouseEvent.BUTTON1);
        handler.handleEvent(event, EventType.RELEASED);
       
        assertFalse( handler.isLocked() );
        assertEquals( 2, handler.getEditBlackboard().getCoords(10,0).size() );
View Full Code Here

       
        list.add( runBehaviour);
        list.add( runBehaviour2);
        list.add( new NoRunBehaviour());
       
        MapMouseEvent event = new MapMouseEvent(null, 0,0,0,0,0);
       
        EventBehaviourCommand command=new EventBehaviourCommand(list, handler, event, EventType.RELEASED);
        command.setMap( (Map) handler.getContext().getMap());
        assertFalse( runBehaviour.ran );
        assertFalse( runBehaviour2.ran );
View Full Code Here

     */
    @Test
    public void testUpdateState() throws Exception {
        TestMouseTracker tracker=new TestMouseTracker(new TestHandler() );

        MapMouseEvent event=new MapMouseEvent( DISPLAY, 10,15,NONE,BUTTON1, BUTTON1 );
        tracker.updateState(event, EventType.MOVED);
       
        assertEquals(Point.valueOf(10,15), tracker.getDragStarted());
       
        event=new MapMouseEvent( DISPLAY, 10,10,NONE,BUTTON1, BUTTON1 );
        tracker.updateState(event, EventType.DRAGGED);
        assertEquals(Point.valueOf(10,15), tracker.getDragStarted());
       
    }
View Full Code Here

        };

        handler.getBehaviours().add(locker);

        MapMouseEvent event = new MapMouseEvent(null, 0, 0, 0, 0, 0);
        handler.handleEvent(event, EventType.RELEASED);

        assertTrue(ran[0]);
        assertTrue(ran[1]);
        assertTrue(ran[2]);
View Full Code Here

        final int alt = MapMouseEvent.ALT_DOWN_MASK;
        final int button1 = MapMouseEvent.BUTTON1;
        final int button2 = MapMouseEvent.BUTTON2;
       
        TestHandler handler=new TestHandler();
        assertFalse(mode.isValid(handler, new MapMouseEvent(null, 0, 0, none, none, 0), EventType.DOUBLE_CLICK));
        assertFalse(mode.isValid(handler, new MapMouseEvent(null, 0, 0, none, none, button1), EventType.PRESSED));

        handler.setCurrentShape(handler.getEditBlackboard().getGeoms().get(0).getShell());
        handler.getEditBlackboard().addPoint(10,0, handler.getCurrentGeom().getShell());

       
        assertFalse(mode.isValid(handler,  new MapMouseEvent(null, 10, 0, none, none, button1), EventType.PRESSED));
        assertFalse(mode.isValid(handler, new MapMouseEvent(null, 10, 0, none, none, button1), EventType.DRAGGED));
        assertFalse(mode.isValid(handler, new MapMouseEvent(null, 10, 0, none, none, button1), EventType.DRAGGED));
        assertFalse(mode.isValid(handler, new MapMouseEvent(null, 10, 0, none, none, button1), EventType.EXITED));
        assertFalse(mode.isValid(handler, new MapMouseEvent(null, 10, 0, none, none, button1), EventType.MOVED));
        assertTrue(mode.isValid(handler, new MapMouseEvent(null, 10, 0, none, none, button1), EventType.RELEASED));

        assertTrue(mode.isValid(handler, new MapMouseEvent(null, 10,0, ctrl,none, button1), EventType.RELEASED));
        assertTrue(mode.isValid(handler, new MapMouseEvent(null, 10,0, shift, none, button1), EventType.RELEASED));

        assertFalse(mode.isValid(handler, new MapMouseEvent(null, 10,0, alt, none, button1), EventType.RELEASED));
        assertFalse(mode.isValid(handler, new MapMouseEvent(null,
                0, 0, shift|ctrl, button1, button1), EventType.RELEASED));
       
        assertFalse(mode.isValid(handler,  new MapMouseEvent(null, 10, 0, none, none, button2), EventType.RELEASED));
    }
View Full Code Here

        handler.getEditBlackboard().addPoint(15,15, handler.getCurrentGeom().getShell());
        handler.getEditBlackboard().addPoint(20,15, handler.getCurrentGeom().getShell());
        handler.getEditBlackboard().addPoint(30,25, handler.getCurrentGeom().getShell());
       
        //test click on point
        handler.handleEvent(new MapMouseEvent(null, 9, 10, none, none, button1), EventType.RELEASED);
        assertEquals(1, handler.getEditBlackboard().getSelection().size());
        assertEquals(Point.valueOf(10,10), handler.getEditBlackboard().getSelection().iterator().next());

        //test click on same point
        handler.handleEvent(new MapMouseEvent(null, 10, 10, none, none, button1), EventType.RELEASED);
        assertEquals(Point.valueOf(10,10), handler.getEditBlackboard().getSelection().iterator().next());
        assertEquals(1, handler.getEditBlackboard().getSelection().size());
       
        //test click on new point
        handler.handleEvent( new MapMouseEvent(null, 15, 15, none, none, button1), EventType.RELEASED);
        assertEquals(Point.valueOf(15,15), handler.getEditBlackboard().getSelection().iterator().next());
        assertEquals(1, handler.getEditBlackboard().getSelection().size());
       
        //test add to selection via SHIFT-click
        MapMouseEvent event = new MapMouseEvent(null, 10, 10, shift, none, button1);
        handler.handleEvent( event, EventType.RELEASED);
        assertEquals(2, handler.getEditBlackboard().getSelection().size());
        assertTrue(handler.getEditBlackboard().getSelection().contains(Point.valueOf(10,10)));
        assertTrue(handler.getEditBlackboard().getSelection().contains(Point.valueOf(15,15)));
       
        //test no change to selection if SHIFT-click on selected vertex
        event= new MapMouseEvent(null, 15, 15, shift, none, button1);
        handler.handleEvent( event, EventType.RELEASED);
        assertEquals(2, handler.getEditBlackboard().getSelection().size());
        assertTrue(handler.getEditBlackboard().getSelection().contains(Point.valueOf(10,10)));
        assertTrue(handler.getEditBlackboard().getSelection().contains(Point.valueOf(15,15)));
       
        //test add to selection via CTRL-click
        event= new MapMouseEvent(null, 20, 15, ctrl, none, button1);
        handler.handleEvent( event, EventType.RELEASED);
        assertEquals(3, handler.getEditBlackboard().getSelection().size());
        assertTrue(handler.getEditBlackboard().getSelection().contains(Point.valueOf(10,10)));
        assertTrue(handler.getEditBlackboard().getSelection().contains(Point.valueOf(15,15)));
        assertTrue(handler.getEditBlackboard().getSelection().contains(Point.valueOf(20,15)));
       
        //test remove from selection via CTRL-click
        event= new MapMouseEvent(null, 15, 15, ctrl, none, button1);
        handler.handleEvent( event, EventType.RELEASED);
        assertEquals(2, handler.getEditBlackboard().getSelection().size());
        assertTrue(handler.getEditBlackboard().getSelection().contains(Point.valueOf(10,10)));
        assertTrue(handler.getEditBlackboard().getSelection().contains(Point.valueOf(20,15)));
       
        //test no change when SHIFT-click and CTRL-click on nothing
        event= new MapMouseEvent(null, 300, 300, shift, none, button1);
        handler.handleEvent( event, EventType.RELEASED);
        assertEquals(2, handler.getEditBlackboard().getSelection().size());
        assertTrue(handler.getEditBlackboard().getSelection().contains(Point.valueOf(10,10)));
        assertTrue(handler.getEditBlackboard().getSelection().contains(Point.valueOf(20,15)));
       
        event= new MapMouseEvent(null, 300, 300, ctrl, none, button1);
        handler.handleEvent( event, EventType.RELEASED);
        assertEquals(2, handler.getEditBlackboard().getSelection().size());
        assertTrue(handler.getEditBlackboard().getSelection().contains(Point.valueOf(10,10)));
        assertTrue(handler.getEditBlackboard().getSelection().contains(Point.valueOf(20,15)));
       
        handler.getEditBlackboard().selectionClear();
       
        //test no add when click SHIFT-click and CTRL-click on nothing
        event= new MapMouseEvent(null, 300, 300, shift, none, button1);
        handler.handleEvent( event, EventType.RELEASED);
        assertEquals(0, handler.getEditBlackboard().getSelection().size());

        event= new MapMouseEvent(null, 300, 300, ctrl, none, button1);
        handler.handleEvent( event, EventType.RELEASED);
        assertEquals(0, handler.getEditBlackboard().getSelection().size());

    }
View Full Code Here

       
        handler.getEditBlackboard().addGeometry((Geometry) feature.getDefaultGeometry(), feature.getID());
       
        handler.getMouseTracker().setDragStarted(Point.valueOf(0,10));
       
        MapMouseEvent event=new MapMouseEvent(null, 10,10,MapMouseEvent.NONE,MapMouseEvent.BUTTON1, MapMouseEvent.BUTTON1);
        handler.handleEvent(event, EventType.DRAGGED);
       
        event=new MapMouseEvent(null, 20,10,MapMouseEvent.NONE,MapMouseEvent.BUTTON1, MapMouseEvent.BUTTON1);
        handler.handleEvent(event, EventType.DRAGGED);

        event=new MapMouseEvent(null, 20,20,MapMouseEvent.NONE,MapMouseEvent.BUTTON1, MapMouseEvent.BUTTON1);
        handler.handleEvent(event, EventType.DRAGGED);

        event=new MapMouseEvent(null, 10,20,MapMouseEvent.NONE,MapMouseEvent.BUTTON1, MapMouseEvent.BUTTON1);
        handler.handleEvent(event, EventType.DRAGGED);

        handler.handleEvent(event, EventType.RELEASED);
       
        handler.handleEvent(event, EventType.DOUBLE_CLICK);
View Full Code Here

        this.crs, this.viewportPane, this.layers, this.viewportModel
        );
   
    infoTool.setContext(context);
   
    MapMouseEvent e = new MapMouseEvent(null, 5, 5,
        MapMouseEvent.NONE, MapMouseEvent.NONE, MapMouseEvent.NONE);
   
        /*
         * box from from InfoTool.mouseReleased()
         */
        Envelope box = context.getBoundingBox( e.getPoint(), 5 );
        ReferencedEnvelope bbox;
        if( box instanceof ReferencedEnvelope) {
            bbox = (ReferencedEnvelope) box;
        }
        else {
View Full Code Here

     * TODO summary sentence for mouseWheel ...
     *
     * @param event
     */
    private void mouseWheel( Event e ) {
        MapMouseEvent m = new MapMouseWheelEvent(pane, e.x, e.y, e.stateMask, getButtonsDown(e), getButton(e.button),
                e.count);
        eventJob.fire(EventJob.WHEEL, m);
    }
View Full Code Here

TOP

Related Classes of org.locationtech.udig.project.ui.render.displayAdapter.MapMouseEvent

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.