Re: [OpenMap Users] Adding name to OMGraphics?

From: Piotr Kamiński <Piotr.Kaminski@ctm.gdynia.pl>
Date: Wed Jul 23 2003 - 05:37:27 EDT

----- Original Message -----
From: "Don Dietrick" <dietrick@bbn.com>
To: "Piotr Kamiński" <Piotr.Kaminski@ctm.gdynia.pl>
Cc: <openmap-users@bbn.com>
Sent: Tuesday, July 22, 2003 5:32 PM
Subject: Re: [OpenMap Users] Adding name to OMGraphics?

> Hi Piotr,

Hi Don,

>
> On Monday, July 21, 2003, at 03:40 AM, Piotr Kamiński wrote:
>
> > Hello,
> > I wrote last week about enhancing OMDrawingTool. There is another
>
> Thanks for sending that code in last week, I'm still working with it.
>
> > problem I found. If I draw some objects in DrawingLayer I can
> > select them (using mouse click in gestures mode) to edition. But how
> > can I remove such object?
>
> If you are using 4.6, you can add the
> com.bbn.openmap.gui.OMGraphicDeleteTool to the openmap.components
> property, and a button will appear on the ToolPanel that lets you
> delete any selected OMGraphic. The pop-up menu that is provided by the
> OMDrawingTool on a right-click or cntrl-click also has a delete option.
>

I'm using 4.6 version but I have my own JFrame and I don't use ToolPanel.
So I probably won't use OMGraphicDeleteTool.

>
> > I'd like to see list of OMGraphics object added to particular
> > DrawingLayer.
> > This list could be displayed in layer's palette in separated tab, or
> > something.
> > User could select objects on this list, selected object should be
> > automaticaly selected on map and user could start editing it. He/she
> > can also remove
> > object from list (and layer). Such list helps in orientation what I
> > really
> > drew.
> > List can be make easly but I'd like to see not only OMGraphic class
> > but rather name of particular OMGraphi object. Is there any
> > possibility to
> > attach name to OMGraphic objects? I could use 'appObject' field for
> > this
> > but it might be use in other way in some applications.
>
> Since there are so many applications where a name isn't used for
> OMGraphics, I'd rather not permanently add it to the API for
> OMGraphics. Seems like you could get the same functionality with a
> java.util.Map, and extending a DrawingLayer to present that list for
> you in its palette.

Yes, I could do something like this, but there is one problem.
How can user add names to particular OMGraphic? I should extend all
panel where OMGraphics parameters are specified. I don't like this way.
Maybe I will stay just with list of class names of OMGraphic elements.
I can also automatically add names using class concatenated with number
1, 2, 3 and so on.

>
> > By the way: Decorated Splines doesn't renders in my configuration,.
> > (I use OpenMap 4.6 version). It seems working when I'm clicking on
> > map points are added but nothing is drawn. Sometimes I could even
> > select such 'invisible' object for edition but still nothing is drawn.
>
> So they don't appear in the DemoLayer for you? Are you creating them
> programmatically or using the DrawingTool?

I'd like to create them ustig DrawingTool.
I run standard OpenMap 4.6 application and made some tests.
I've used three layers: 'dtlayer', 'distlayer' and 'drawing' (the last one
was
added by me)

 - there are beautiful decorated splines on demo layer. (I'd like to use
 them in my program!) I could move it and change parameters but I can't
 create them. If I try to draw decorated spline on any drawing layer
 I only see handles (small white boxes), not lines.

 - If I display palette to decorated spline I can only change standard
 parameters. How can I define 'decorations' or text? Are you going to
 modify standard palette?

 - when I edit drawings on 'dtlayer' and 'distlayer' (Those layers
 are new in 4.6, aren't they) I can't move handle of polyline because
 popup menu appears "Drop target". :-(

 - when I edit darawings using 'drawing' layer I can move handles and
 no popup menu appears, for me it's OK

 - popup menu doesn't work on righ mouse button. It works with ctrl+left
button.
 (I preffer popup menu on right button, what to do to achieve that?)
 But there are some problems:
     - I have first select object using gestures mouse mode
     - ctrl+left works on whole map except drawn object
     - when menu appears selection handles disapplears (they disappears but
     I can still edit polylines - move handles) I think it is problem with
     drawing handles - OMGraphics is probably still in edit mode.
     - after a few edit, select, popup menu actions I have empty frame
     from OMGraphic palette window (JPanel was closed or hidden?). I also
     can't create new drawings because OMDrawingToolLauncher stoped working.
     It didn't created new drawings. I think that some object was still in
     edit mode but I can't access it. It doesn't react in gestures mode.

What do you think about adding delete button to OMGraphics object palette?
Then popup menu is not needed. Some kind of users have problems with popup
menus :-( .

I thought I could use new 'dtlayer' and icons on ToolPanel but (as I wrote)
I don't have ToolPanel and event I if I do there is next problem.
I make an assumption: one users' drawing = one layer. When I configured
OpenMap to have two 'dtlayer' object I have doubled icons on ToolPanel :-(

>
> > I've also found that OMSpline object is not serializable. I can't use
> > it in my drawings if I want to store them in files on disk.
>
> The readObject/writeObject methods might have to be modified to adjust
> for the parameters they have that may not be serializable. I'll put
> that on the list, but I'm not sure it'll be changed before 4.6 gets
> released.

If you could give me some guidelines I could do this. Serialization is
crucial in my project.

I have also problem with projection. I wrote some time ago that we
created our own projection based on external C S-57 chart library.
It works good but I found that rhumb lines are drawn incorrectly.
When I draw polyline using GreatCircle or stight lines it's ok.
When I change line type to Rhumb I have handles located in the same
place but polyline is drawn with different verticles. They are moved.
I think that we have problems in our projection class.
This class is based on Cylindrical class and we select Mercator projection
in external C library. Could you take a look at attached source file?
Maybe there is soething obvious we overlook.

To convert X,Y to LatLon we user View class and two native methods.
Here is manual for them:
Synopsis:
       #include <eckernel.h>

       Bool EcDrawXyToLatLon(
               EcView *view,
               int x,
               int y,
               EcCoordinate *lat,
               EcCoordinate *lon )

Parameter:
       In/Out Name Description
       in view pointer to view structure
       in x Horizontal device coordinate in pixels
       in y Vertical device coordinate in pixels

       out lat Latitude in degrees (north positive, south
negative)
       out lon Longitude in degrees (east positive, west
negative)

Description:

Transforms device coordinates into latitude and longitude of a geographic
position (local datum). To shift the position to WGS84, use
EcDrawShiftToWGS84().

Return Value:

True on sucess, False if x,y cannot be transformed into latitude and
longitude.

Synopsis:
       #include <eckernel.h>

       Bool EcDrawLatLonToXy(
               EcView *view,
               EcCoordinate lat,
               EcCoordinate lon,
               int *x,
               int *y )

Parameter:
       In/Out Name Description
       in view pointer to view structure
       in lat Latitude in degrees (north positive, south
negative)

       in lon Longitude in degrees (east positive, west
negative)
       out x Horizontal device coordinate in pixels
       out y Vertical device coordinate in pixels

Description:

Transforms latitude and longitude of a geographic position into device
coordinates. The geographic position is expected to be in local datum. To
shift it to WGS84, use EcDrawShiftToWGS84().

Return Value:

True on success, False if invalid latitude or longitude given.

We use WGS84. This library has also two functions to calculate rhumb and
great circle lines:

Synopsis:
       #include <eckernel.h>

       Bool EcCalculateRhumblineDistanceAndBearing(
               int datum,
               EcCoordinate inlat1,
               EcCoordinate inlon1,
               EcCoordinate inlat2,
               EcCoordinate inlon2,
               double *dist,
               double *course )

Parameter:
       In/Out Name Description
       in datum local datum

       in inlat1 latitude of position 1 [decimal degrees]
       in inlon1 longitude of position 1 [decimal degrees]
       in inlat2 latitude of position 2 [decimal degrees]
       in inlon2 longitude of position 2 [decimal degrees]
       out dist distance in nautical miles
       out course bearing in nautical degrees

Description:

Calculates loxodromic course and distance between position 1 and position 2.
See EcCalculateGreatCircleDistanceAndBearing for values of local datum.

Return Value:

True on success, False on error.

Synopsis:
       #include <eckernel.h>

       Bool EcCalculateGreatCircleDistanceAndBearing(
               int datum,
               EcCoordinate inlat1,
               EcCoordinate inlon1,
               EcCoordinate inlat2,
               EcCoordinate inlon2,
               double *dist,
               double *startCourse,
               double *endCourse )

Parameter:
       In/Out Name Description

       in datum local datum
       in inlat1 latitude of position 1 [decimal degrees]
       in inlon1 longitude of position 1 [decimal degrees]
       in inlat2 latitude of position 2 [decimal degrees]
       in inlon2 longitude of position 2 [decimal degrees]
       out dist distance in nautical miles
       out startCourse start bearing in nautical degrees
       out endCourse end bearing in nautical degrees

Description:

Calculates distance, initial and end course on the great circle which
connects position 1 and position 2. The local datum has to be specified by
one of the following values:
EC_GEO_DATUM_WGS84 EC_GEO_DATUM_WGS72 EC_GEO_DATUM_ED50 EC_GEO_DATUM_PD
EC_GEO_DATUM_S4283 EC_GEO_DATUM_NAD27
Default datum is WGS84. The local datum for a view context is set with
EcDrawSetDatum.

Return Value:

True on success, False on error.

But I'm not sure if we should use them in projection class.

Regards,
Piotr

>
> Regards,
>
> Don
> --
> [To unsubscribe to this list send an email to "majdart@bbn.com"
> with the following text in the BODY of the message "unsubscribe
openmap-users"]
>

--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Wed Jul 23 05:42:13 2003

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:36 EDT