Re: [OpenMap Users] DeclutterMatrix

From: Don Dietrick <dietrick_at_bbn.com>
Date: Tue, 29 Apr 2008 12:38:16 -0400

Hi Alessio,

The DeclutterMatrix is most tightly coupled with the LocationLayer and
LocationHandlers. They serve as the best example of how to use it.
Basically, the Location objects know how to query the DeclutterMatrix
for the planned location of a text label, and then accept an
alternative location from the matrix and reset the location of the
text to that location.

Hope this helps,

Don

On Apr 28, 2008, at 9:41 AM, Alessio Iannone wrote:

> Hi,
> I am trying to use the DeclutterMatrix in order to be able to
> declutter labelling of Shape File Features (road) according to DBF
> data and configured Rules.
> I need more info and or example on how to use it.
> I have tried to integrate it into the following class OMGraphic
> where i have added
>
> public Point setDeclutter(OMLabeler labeler) {
> if(labeler==null || declutterMatrix==null ||
> declutterType==DECLUTTERTYPE_NONE) return null;
> if(declutterType==DECLUTTERTYPE_MOVE){
> if (labeler instanceof OMText){
> OMText text = (OMText)labeler;
> Point mapLoc = text.getMapLocation();
> FontMetrics fm =
> FontDesignMetrics.getMetrics(text.getFont());
> int fontSize = text.getFont().getSize();
> int width=fm.stringWidth(text.getData());
> int heigth=fm.getHeight();
> Point takenPoint =
> declutterMatrix.setNextOpen(mapLoc, width,heigth);
> declutterMatrix.setTaken(takenPoint, width,heigth);
> return takenPoint;
> }
> }
> return null;
> }
>
> now i have Overrided the setLocation(Point p) of an OMLabeler instance
> with a code like this:
>
> public void setLocation(Point p) {
> try{
> super.setLocation(p);
> Point newPos= setDeclutter(this);
> super.setLocation(newPos);
> }catch (Exception e) {
> StringWriter sw = new StringWriter();
> PrintWriter pw = new PrintWriter(sw);
> e.printStackTrace(pw);
> Debug.output(sw.toString());
> }
> }
>
> A part the double call to super.setLocation all the label are shown
> on the top left corner......any hints, suggestion, tutorial or so on?
>
> Best Regards
> .
> Alessio Iannone
> Software Engineer
>
> Mobile: 39 329 8834960
> Email: alessio.iannone_at_nextant.it
> IM: quonn77_at_hotmail.com (AIM)
> http://www.linkedin.com/in/alessioiannone
> Web sites of the Martial Arts I play
>
> Nextant - Navcomm Applications
> Via Alessandro Noale
> See who we know in common
> Want a signature like this?
>
>
> Tante idee per la salvaguardia del pianeta su
> Yahoo! for good.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Don Dietrick, dietrick_at_bbn.com
BBN Technologies, Cambridge MA
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



--
[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 Tue Apr 29 2008 - 12:38:25 EDT

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