|
Basically, I have written a icon group manager dialog where users
can create their own groups of icons which are then displayed in a tabbed pane,
on for each group, in a View at the side of the
map. So the first I know about it is when they drop the icon
onto a map.
I am
not sure if I understand exactly how an sld works yet. If there is one
sld file per shape file(?), then I guess I have to create a new one for each
layer from my code - just string write it out to a file on the drop of the first
icon of that type when I create the new layer/shapefile, with the icon path hard
coded - assuming the External Graphic can be a local file reference and not
just a web address?
Is
this my only choice? If so, I can go ahead an code for that.
I have
not yet figured out how I associated the sld with the shapefile so that it is
used to draw the layer, any
hints/pointer/tutorials/examples?
Thanks
Michelle
So it appears I'm wrong about External Graphics. It seems they have
to be known ahead of time. That is a little annoying. How many
graphics will you have? Is it an open set?
Jesse
On 16-Mar-06, at 6:50 AM, M.S.Bachler wrote:
Hi!
That all sounds wonderful :-)
I
have only the vaguest idea about what it all meant at the
moment.
I
looked at the AttributeExpression class, but I had no idea what to do
next.
Any example code/usage with AttributeExpressions anywhere you can
point me at to demistify things?
Googling was not fruitful, or maybe I Googled for the wrong
thing.
Thanks.
Michelle
If you look at an SLD you can see that most
properties of symbolizers and graphics are actually expressions. In
GeoTools there are AttributeExpressions which basically return the value
of an attribute. If each feature has an attribute which is a URL
then an _expression_ can created which will return the URL. You can
construct a Graphic object whose URL is determined by an
AttributeExpression. In this way you do no need to hard-code the set
of images that will be displayed.
Jesse
On 14-Mar-06, at 3:37 AM, M.S.Bachler wrote:
Hi!
I think my problem is that I do not have a fixed set of icons I
can hardcode into an SLD.
The user can create icon groups holding any
images.
So I need the whole process to be dynamic
somehow.
Not sure if this is possible. Still trying to understand how
shapefiles and SLD information fits together.
But I hope so.
Michelle
M.S.Bachler wrote:
You wrote:
"Another possibility is to create a
point shapefile and one of the attributes can be a URL to an image.
The style
you can define for the layer can simply display that icon at the
location of the point."
I think this is the way I need to
go.
Bearing in mind I am not up to speed with
uDig and GIS, this is what I believe I need to achieve and the
associated question I have (some of which may be
silly).
I need to create
layers pointing to local
shape files, which each will display one type of
icon.
So they can turn the layers on an off.
Display all the fish, then all
the huts etc.
Q: Can one shapefile hold information about
more than one icon/point? (I am sure it can - I just what to be
certain) I am writing an app at
the moment that does a similar thing to what you are discussing. I am
going to describe what I do so that you are aware of what can be done
if you want to take that path.
I have a single layer that I
create road events on. I wrote a tool that when I click on the map it
selects the location (this tool is similar to the DnD option that you
are discussing) and opens a form for the user to enter the road event
details. At this stage they choose the type of road event, ie Road
Works, Road Hazard, etc. When they save the form a new Feature is
created on the layer with an attribute for the type. I use SLD with
multiple Rules to display icons for each type of event on that layer,
driven off the type attribute. If you want an example of the SLD with
multiple rules let me know. Here's an example of what my map looks
like:
<snapshot2.png> The labels are just for
testing. They are also defined in the SLD and are driven off another
attribute to describe the state of the event.
I can also turn
on and off each event type, exclude events inside/outside a date
range, exclude closed events, etc with filters on the layer. In order
to do this I had to extend BasicFeatureRenderer and register my own
renderer using the uDig renderer extension point. It's just an exact
copy of BasicFeatureRenderer, but the setQueries() method does
something different. This renderer applies a Filter to the layer just
before it is rendered. I have created a view with a form that the user
selects the attributes that they want to filter on and then click
apply. The filter is stored on the layer blackboard and then when the
map is refreshed the renderer grabs the filter from the blackboard and
applies it to the layer first. Here is an example of the same data
being filtered to only show Road Hazards on the road event
layer:
<snapshot4.png>
Obviously the fonts are
set up for Windows and I'm developing in Linux...
In terms of
your data, if the different types have the same attributes (ie you
only store an id, name and geom for example) then you may be able to
take this approach and use a single shape file. Otherwise you will
have to continue using different layers/shapefiles.
Again, I
don't know if this will help you, but I have taken a lot of
knowledge/advice from the uDig guys and would like to put back what I
can. Hopefully I will be able to develop some code that is not
specific to my project that I can put back into uDig to do this sort
of thing. ;-)
Mark
As they drag an icon from the palette, I
need to determine if I have a layer already for that type of
icon.
I was hoping to use the layer name = icon
name.
Q: Is the layer name stored in the shape
file, i.e. is it persistent?
If there is already a layer displaying say
huts, I need to create a new point displaying the hut icon dropped
else I need to create a new layer and add the icon to
that.
Q: Is it possible to add a right-click menu
to an icon on a layer (I guess to a point object - though I am still
fuzzie about this a present)?
I need to be able to associated a point
icon with a Compendium map (an external
application).
I am going to use sockets to achieve
this.
Q: What information do I need to store in
Compendium for it to be able to request uDig to open a specific
project, map and layer to link it back to a specific icon on a map?
Is it just the .umap file and a layer ID of some kind? If so, how do
I programmatically find out what the current .umap file is?, and how
do I use that later to re-open that map?
Extra: They have not asked for this yet,
but I am guessing that they may expect to be able to drag the icons
around the map to relocate them.
Q: Is this currently possible. If not, is
this as simple as adding a drag/drop event to an object somewhere,
or are we talking really complicated?
Sorry about all the questions.
After a sleepless night worrying, I am
trying to crystalize what I need to achieve, and some of the
questions I have at this stage.
Thanks for your patients with me so
far.
Michelle
For map
graphic you don't have to worry about getting a mapgraphic context
it will be passed in to the mapgraphic draw method. So don't
worry about that. An example of the map graphic API in use
is the scalebar mapgraphic in one of the printing plugins...
printing.ui I think.
Another possibility is to create a
point shapefile and one of the attributes can be a URL to an
image. The style you can define for the layer can simply display
that icon at the location of the
point.
Jesse
M.S.Bachler wrote:
Hi!
I am not sure which of the suggested routes to take.
Maybe I should explain a little more about these icons.
They are going to be used for land management for a research project in
Guyana.
So they will be images of fish, birds, huts, that sort of thing.
Users will want to drag a bird say, onto an area of the map where there
are a lot of these birds.
They will need to be able to double-click the bird icon and open a
discussion map in the Compendium application -
www.compendiuminstitute.org (the software I actually develop), where
that bird population can then be discussed or whatever. The Compendium
map will need to link back to that bird icon on that map (somehow!!?) so
users can move between the two applications easily.
This is much more complicated then my original brief. And goes into
areas I know nothing about.
I will need to understand much more about shape files and data storage
so that I can store the icon data position, associated Compendium map
details etc. I have no idea how to do any of this at the moment.
I am just starting to get my head into coding in Eclipse and for uDig.
So far I have managed to write a plugin to manage collections of icons
as groups, with the icons stored locally and the data stored in XML
files (easy really just using the Eclipse API).
I am just looking at writing the view to display these icon groups which
the user can drag from.
The rest of the Eclipse and uDig API is a complete mistery and I get
lost very easily.
I started looking at MapGraphic in the API and straight away could not
work out how to get a MapGraphicContext.
As usual in life, there is just me, with lost of projects and no time.
If someone could spoon-feed me a little with the image drop/shapefile
data storage issues to help me get into uDIG API quickly I would really
appreciate the help at this point.
Thanks
Michelle
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of Jesse
Eichar
Sent: 10 February 2006 17:36
To: User-friendly Desktop Internet GIS
Subject: Re: [udig-devel] Difficulty with raster images using World
Image Files
That's a possibility too. But only if the attribute exists in the
feature. If it is only for viewing then maybe not.
Oh. I should mention that map graphics don't automatically save.
However things in the Map.getBlackboard() do save. Any object on the
blackboard that has a "persister" extension can be saved and loaded.
See the net.refractions.udig.project.persister extension point for more
information on that.
Jesse
Jody Garnett wrote:
M.S.Bachler wrote:
Hi!
I need to create a panel of icons that can be dragged and dropped
onto a map layer.
That sounds a like a "FeatureEditor" to me. Make a tool that adds
points to the map, and based on an attribute displays the correct
icons. Then make a custom feature editor that will let the user change
the icon nicely. Finally make a view that has your icons on it, and
based on the currently selected one it will create a feature of the
appropriate type.
The actual data could be a shapefile, or a database or anything.
Jody
_______________________________________________
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
-- This message has
been scanned for viruses and dangerous content by MailScanner, and
is believed to be clean. _______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel
-- This message has been scanned
for viruses and dangerous content by MailScanner, and is
believed to be clean.
<snapshot2.png>
<snapshot4.png>
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
|