RE: [OpenMap Users] How to insert A symbol of the milStd2525 (UNCLASSIFIED)

From: Lackey, Michael B. (SED/BTI) <"Lackey,>
Date: Fri, 21 Sep 2007 08:59:35 -0500

Classification: UNCLASSIFIED
Caveats: NONE

I used OMScalingIcon. Here is an example:

public class MyIconObject
{
    /**
     * the openmap icon
     */
    protected OMScalingIcon omIcon = null;

    /** Creates a new instance of an icon object*/
    public MyIconObject(float lat, float lon, String fileName)
    throws MyException
    {
        if (fileName == null) {
            throw new MyException ("MyIconObject: null filename");
        }
        ImageIcon imageIcon = new ImageIcon(fileName);
        if (imageIcon == null) {
            throw new MyException ("MyIconObject: null ImageIcon");
        }
        omIcon = new OMScalingIcon(lat, lon, imageIcon);
        if (omIcon == null) {
            throw new MyException ("PointObject: null OMScalingIcon");
        }
        // at map scale of 1:500,000 the icon will appear full size omIcon.setBaseScale(500000f);
        // icon will be scaled (larger) until map scale > value
        omIcon.setMaxScale(500000f);
        // icon will be scaled (smaller) until map scale < this value
        omIcon.setMinScale(defaultIconMinScale);
        // when selected, color is red
        omIcon.setSelectPaint(Color.red);
    }
}

For my applicaton, MyIconObject "has a" OMScalingIcon, rather than "is a" OMScalingIcon. I chose this design for a particular reason. But the "is a" relationship is also logical (and perhaps more intuituve):

public class MyIconObject extends OMScalingIcon
{
}

Next, BasicLocationHandler.java will need a list of all objects on the map. The location handler is responsible for the creating/maintaining the list. Here is sample code:

public class MyObjectHandler
{
    // a list of all objects on the map
    protected Vector<MyIconObject> objList;

    // add an object to the map
    public void addIconObject (MyIconObject obj) {
        objList.add(obj);
    }

    /**
     * When the layer receives a new projection, it goes to each
     * objectHandler and asks it for additions to the layer's graphic list
     */
    public void get
    (float nLat, float wLon, float sLat, float eLon, Vector graphicList)
    {
        for (int i=0; i<objList.size(); i++)
        {
            // the object is an icon image, or similar,
            // and is defined by a singular point.
            // if the point is within the projection, show the image.
            MyIconObject iconObj = objList.get(i);
            if ((sLat <= iconObj .getLat()) && (iconObj .getLat()<= nLat))
            {
                if ((wLon <= iconObj .getLon()) && (iconObj .getLon()<= eLon))
                {
                    graphicList.add(iconObj);
                }
            }
        }
    }
}

Finally, create icons and add them to the map:

      MyIconObject myIcon= new MyIconObject (lat, lon, "C:/somefile.png");
        MyObjectHandler myHandler = myLayer.getMyHandler();
        myHandler.add (myIcon);
        myLayer.doPrepare();

Mike Lackey

-----Original Message-----
From: Magdalini Zachariadou [mailto:m.zachariadou_at_rheinmetall.it]
Sent: Friday, September 21, 2007 5:38 AM
To: Lackey, Michael B. (SED/BTI); openmap-users_at_bbn.com
Subject: Re: [OpenMap Users] How to insert A symbol of the milStd2525 (UNCLASSIFIED)

I'm sorry to bother again.
I followed your suggestions.
I created a LocationLayer
I created a BasicLocationHandler
I added the LocationLayer to the BasicLocationHandler But now I'm stuck to the addition of an Icon to the map.
Let's say I have a #1.ico What Object should I create and Where do I added.
I tryied with an JIcon and Image but I couldn't added neither to theLayer nor to the Handler.
Is there an intermediate sep to take that I'm missing?

How should I go on?

Thanks in advance for everything
Mandy
----- Original Message -----
From: "Lackey, Michael B. (SED/BTI)" <michael.lackey1_at_us.army.mil>
To: "Magdalini Zachariadou" <m.zachariadou_at_rheinmetall.it>; <openmap-users_at_bbn.com>
Sent: Thursday, September 20, 2007 4:17 PM
Subject: RE: [OpenMap Users] How to insert A symbol of the milStd2525
(UNCLASSIFIED)


Classification: UNCLASSIFIED
Caveats: NONE

I did not find a way to do this without writing some code. But also, at that time, Openmap was new subject for me, so maybe I just did not know.
This is what I did. If anyone knows better way, please say so.

(1) Used "Location" layer by modifying the openmap.properties file.

(2) Created data handler for the layer by modifying file BasicLocationHandler.java to fit my needs.

(3) Created icons using milStd2525_png.jar file. There are some additional
helper tools in tools/symbology/milstd2525 folder.

(4) Placed the icons on the map by adding them to the data handler.

Once you understand what a data handler does, the rest is easy. Look at
LocationLayer.prepare() and BasicLocationHandler.get() for examples.

Mike Lackey

-----Original Message-----
From: owner-openmap-users_at_bbn.com [mailto:owner-openmap-users_at_bbn.com] On Behalf Of Magdalini Zachariadou
Sent: Thursday, September 20, 2007 7:20 AM
To: openmap-users_at_bbn.com
Subject: [OpenMap Users] How to insert A symbol of the milStd2525

Hello to all.
I would like to ask if anyone knows how to insert in a layer a symbol of milStd2525.

here is the code of my layer.

import java.awt.*;
import com.bbn.openmap.Layer;
import com.bbn.openmap.event.ProjectionEvent;

public class FirstLayers extends Layer {
    public FirstLayers {
    }
    public void paint(Graphiccs g){
    }
    public void projectionChangd(ProjectionEvent e){} }


How should I go on? I would like to insert and position in the FirstLayer a symbol of the milStd2525 in order to be able to see it in the mapbean I have created.

Thanks in advance.


________________________________

Si comunica che a seguito del cambiamento di ragione sociale della nostra ditta da "Oerlikon Contraves SpA" a "Rheinmetall Italia SpA", a partire dal
01/08/2007 il dominio di posta elettronica oci.it č stato sostituito dal nuovo dominio rheinmetall.it.
Tutti gli indirizzi n.cognome_at_oci.it esistenti sono sostituiti dai corrispondenti n.cognome_at_rheinmetall.it <mailto:n.cognome_at_rheinmetall.it> ; il vecchio dominio continuerą a funzionare, in ricezione, sino al 31/12/2007.

Please be informed that the mail domain oci.it has changed to the new domain rheinmetall.it, as a consequence of the company name change from "Oerlikon Contraves SpA" to "Rheinmetall Italia SpA".
All present n.surname_at_oci.it <mailto:n.surname_at_oci.it> e-mail addresses have been replaced by the corresponding n.surname_at_rheinmetall.it <mailto:n.surname_at_rheinmetall.it> . Old addresses n.surname_at_oci.it <mailto:n.surname_at_oci.it> will still be active in reception only until 31/12/2007.

Classification: UNCLASSIFIED
Caveats: NONE



 






Si comunica che a seguito del cambiamento di ragione sociale della nostra ditta da "Oerlikon Contraves SpA" a "Rheinmetall Italia SpA", a partire dal 01/08/2007 il dominio di posta elettronica oci.it č stato sostituito dal nuovo dominio rheinmetall.it.
Tutti gli indirizzi n.cognome_at_oci.it esistenti sono sostituiti dai corrispondenti n.cognome_at_rheinmetall.it ; il vecchio dominio continuerą a funzionare, in ricezione, sino al 31/12/2007.
Please be informed that the mail domain oci.it has changed to the new domain rheinmetall.it, as a consequence of the company name change from "Oerlikon Contraves SpA" to "Rheinmetall Italia SpA".
All present n.surname_at_oci.it e-mail addresses have been replaced by the corresponding n.surname_at_rheinmetall.it . Old addresses n.surname_at_oci.it will still be active in reception only until 31/12/2007.
Classification: UNCLASSIFIED
Caveats: NONE

--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Fri Sep 21 2007 - 10:01:50 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:08 EDT