Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [udig-devel] adding a feature to the current map

Hey Vitali,

Thanks for the code/advice. I'm still not up and running because I don't
understand what it is I'm supposed to be doing nor what's supposed to
connect where. 

Also you suggest that I read code. This is what I would like. I'd like
some real examples or answers to the FAQ which aren't junk. However,
there is no code that I have found that I can read. Hence I'm trying to
write my own. The tutorial code I want starts with *nothing*, adds a
button to the user interface, and that button, when clicked, runs a
single chain of code that builds coordinate->geometry->feature-> layer->
map-> project. Ideally with lots of comments explaining what's going on,
why each step is needed, what alternatives are. But no one has bothered
to write that file, so I'm stuck guessing. NOW I'M PISSED OFF BECAUSE
I'M FUCKING TIRED OF GUESSING. I'm not pissed off at you but at each
JTS/Geotools/uDig projects which runs off doing ten million things
before writing the basic tutorials to help get new coders to the point
where they can take care of themselves and perhaps write more
tutorials. 

Okay. Back to "How to make a map 101":
Forget our past conversations because we always start at different
points. Let's assume:
  (1) we have uDig running with a project 'curProj' and map 'myMap'
  (2) we have running plugin code 
  (3) we have built a Geotools Feature 'myFeat'
now we want to add that feature to the current project as a layer in its
own map.

To add the map we will use the "OpenMapCommand" --- okay.

To create the map will need a "createMapCommand" which requires:
  a name - you use null so I take it this is a useless parameter.
  a Java List of IGeoResources - something that resolves to the feature.
  the project to add the map to - we have this as 'curProj'.

So the question is how to build an IGeoResource which will resolve to
the feature when requested.

        I SIMPLY DON'T GET THIS. I'VE BEEN TURNING AROUND FOR A WHILE
        TRYING TO GUESS. 

        Here your code didn't work because you assumed an existing
        shapefile which is exactly what we don't have. That is you
        resolve the IService based on the URL of a shapefile before we
        have even created the shapefile itself.
            serviceFactory.acquire(sourceShpURL);


        From your advice for MemoryDataStore you suggest:
          (1) create MemoryServiceExtensionImpl instance
          (2) use it to get an IService (which is actually
        MemoryServiceImpl)
          (3) from MemoryServiceImpl you can get MemoryGeoResourceImpl
          (4) use it to add a layer, or create a map, whatever.
        I can do (1) although eclipse complains about permissions.
        However, the next step requires an "URL" and a Map without any
        indication what these might be. What's the URL point to? What
        kind of a map was I supposed to create?

Sorry, I've gone around in circles over this stuff and I don't get
what's supposed to happen. If there is code somewhere that does this,
*please* point me towards it. I would love to read working code. Thanks
for any pointers you may choose to provide,


--adrian









Back to the top