[udig-devel] Adding a feature to a layer won't result in an
EventType.EDIT_EVENT
Jesse Eichar
jeichar at refractions.net
Mon Dec 17 20:22:17 PST 2007
That should be ok. I typically use the ApplicationGIS.addLayers()
method. There's a number of nice methods for creating maps and adding
layers there.
I'm having a problem reproducing your bug with the polygon tool. I
will try working with points and lines but so far things have been
going good... For me :). But I'm doing everything through the UI so
maybe there are some bugs if you don't make maps just like me :).
For now I'm going to quickly look into Piebe report (I've put it off
way too long). And when I'm done that I'll make a plugin that creates
a map programatically and see if I can reproduce it that way. In the
mean time if you can think of anything else that I might be able to do
to reproduce your issue please send an email. Maybe the example of
adding the line or points to a layer programatically.
Jesse
On 12-Dec-07, at 4:31 AM, tony.roth at GMX.de wrote:
> Hi,
> this is the way I create the map and add some layers:
>
> // we never save a project or reuse it.
> Project udigProject =
> ProjectPlugin.getPlugin().getProjectRegistry().getDefaultProject();
> Map map = ProjectFactory.eINSTANCE.createMap(udigProject,"myMap",new
> ArrayList<Layer>());
>
> ..
> // creating temporary resource / layer with:
> CatalogPlugin
> .getDefault
> ().getLocalCatalog().createTemporaryResource(myFeatureType);
>
> ...
>
> map
> .sendCommandSync
> (BasicCommandFactory.getInstance().createAddManyLayers(layerList));
>
> as I wrote: no problems with RC8 but with RC12 exceptions when
> closing mapEditor and when adding features with PolygonTool to a
> polygon layer. Programmatically added features to a LINE or POINT
> layer generate no exceptions.
>
> If you need some more code, just write me an email.
>
>
> thanks for your help!
> tony roth
>
>
> -----udig-devel-bounces at lists.refractions.net schrieb: -----
>
>
>
> Its really looking to me like you aren't creating your maps
> correctly. All of the errors you've shown me indicate to me that
> the layers are either not created correctly or added incorrectly to
> the map. How are you creating them?
>
> Jesse
>
> On 7-Dec-07, at 2:53 AM, tony.roth at GMX.de wrote:
>
>> In addition to my first mail:
>> Adding a feature to my temporary layer results in an exception in
>> the logfile.
>> In CreateAndSetNewFeature row 85 the index of the last FeatureEvent
>> is taken from the list. Since this list is empty the index is -1
>> and in row 86 where this index is used to get the last event out of
>> the list a NullPointerException is thrown.
>> btw: The code from row 82 to 87 sounds a bit weird for me.
>> Finally I tried to find out where in LayerImpl the attribute
>> Elist featureChanges
>> is filled.
>> In LayerImpl row 248 the attribute
>> FeatureListener featuerListener is defined by a an anonymous
>> class / implementation of FeatureListener. This featureListener is
>> added by ListenerAddingInterceptor via the plugin.xml using the
>> net.fractions.udig.project.resourceInterceptor and this works but
>> the method changed(FeatureEvent featureEvent) is never called in
>> runtime. Perhaps this is also relevant or based on the same the
>> basic problem.
>> Finally the exception from above:
>> !ENTRY net.refractions.udig.tools.edit 1 0 2007-12-07 11:39:11.765
>> !MESSAGE
>> !STACK 0
>> java.lang.NullPointerException
>> at org.eclipse.emf.common.util.BasicEList.get(BasicEList.java:537)
>> at
>> net
>> .refractions
>> .udig
>> .tools
>> .edit
>> .commands.CreateAndSetNewFeature.run(CreateAndSetNewFeature.java:86)
>> at
>> net
>> .refractions
>> .udig
>> .project.command.UndoableComposite.execute(UndoableComposite.java:81)
>> at
>> net
>> .refractions
>> .udig.tools.edit.BehaviourCommand.execute(BehaviourCommand.java:65)
>> at
>> net
>> .refractions
>> .udig
>> .project.command.UndoableComposite.execute(UndoableComposite.java:78)
>> at
>> net
>> .refractions
>> .udig
>> .tools
>> .edit
>> .behaviour
>> .DoubleClickRunAcceptBehaviour
>> .getCommand(DoubleClickRunAcceptBehaviour.java:100)
>> at
>> net
>> .refractions
>> .udig
>> .tools.edit.EditToolHandler.runEventBehaviours(EditToolHandler.java:
>> 269)
>> at
>> net
>> .refractions
>> .udig.tools.edit.EditToolHandler.handleEvent(EditToolHandler.java:
>> 229)
>> at
>> net
>> .refractions
>> .udig
>> .tools
>> .edit.AbstractEditTool.onMouseDoubleClicked(AbstractEditTool.java:
>> 220)
>> at
>> net
>> .refractions
>> .udig.project.ui.tool.SimpleTool.mouseDoubleClicked(SimpleTool.java:
>> 165)
>> at
>> net
>> .refractions
>> .udig
>> .project
>> .ui
>> .internal
>> .render
>> .displayAdapter.impl.EventJob.sendDoubleClickEvent(EventJob.java:322)
>> at
>> net
>> .refractions
>> .udig
>> .project
>> .ui
>> .internal
>> .render
>> .displayAdapter.impl.EventJob.tryForDoubleClick(EventJob.java:168)
>> at
>> net
>> .refractions
>> .udig
>> .project
>> .ui.internal.render.displayAdapter.impl.EventJob.fire(EventJob.java:
>> 52)
>> at
>> net
>> .refractions
>> .udig
>> .project
>> .ui
>> .internal
>> .render.displayAdapter.impl.EventHandler.mouseUp(EventHandler.java:
>> 160)
>> at
>> net
>> .refractions
>> .udig
>> .project
>> .ui
>> .internal
>> .render
>> .displayAdapter.impl.EventHandler.handleEvent(EventHandler.java:56)
>> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
>> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
>> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:
>> 3682)
>> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:
>> 3293)
>> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:
>> 2389)
>> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
>> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
>> at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
>> at
>> org
>> .eclipse
>> .core.databinding.observable.Realm.runWithDefault(Realm.java:289)
>> at
>> org
>> .eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:
>> 461)
>> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:
>> 149)
>> at de.foo.bar.client.MyApplication.run(MyApplication.java:175)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun
>> .reflect
>> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> at
>> sun
>> .reflect
>> .DelegatingMethodAccessorImpl
>> .invoke(DelegatingMethodAccessorImpl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:585)
>> at
>> org
>> .eclipse
>> .equinox
>> .internal
>> .app.EclipseAppContainer.callMethod(EclipseAppContainer.java:572)
>> at
>> org
>> .eclipse
>> .equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:171)
>> at
>> org
>> .eclipse
>> .core
>> .runtime
>> .internal
>> .adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:
>> 106)
>> at
>> org
>> .eclipse
>> .core
>> .runtime
>> .internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:
>> 76)
>> at
>> org
>> .eclipse
>> .core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
>> at
>> org
>> .eclipse
>> .core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun
>> .reflect
>> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> at
>> sun
>> .reflect
>> .DelegatingMethodAccessorImpl
>> .invoke(DelegatingMethodAccessorImpl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:585)
>> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:508)
>> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
>> at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
>> at org.eclipse.equinox.launcher.Main.main(Main.java:1148)
>> tony roth
>>
>> Von: tony.roth at GMX.de
>>
>> Hi list,
>> we want to upgrade our application >from eclipse 3.2 to 3.3 which
>> means that we also have to upgrade udig. We're using 1.1RC8 and
>> know we have to change to RC12.
>> One of our layers is a temporary layer containing polygon features.
>> It's necessary to catch programatically events when the user adds a
>> polygon using the polygon tool.
>> For this we add an ILayerListener to this layer and in
>> refresh(LayerEvent event) we catch the events with
>> EventType.EDIT_EVENT. In RC8 this works fine but in RC12 (and I
>> think I tried it once with RC11) this doesn't work.
>> Is this a known bug?
>> Are there other possibilities to be informed if a new feature has
>> been added without modifying udig classes?
>> Thank you,
>> tony roth
>> _______________________________________________
>> User-friendly Desktop Internet GIS (uDig)
>> http://udig.refractions.net
>> http://lists.refractions.net/mailman/listinfo/udig-devel
>>
>> _______________________________________________
>> User-friendly Desktop Internet GIS (uDig)
>> http://udig.refractions.net
>> http://lists.refractions.net/mailman/listinfo/udig-devel
>
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel
>
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.refractions.net/pipermail/udig-devel/attachments/20071217/3eb4a9f8/attachment-0001.html
More information about the udig-devel
mailing list