The change you made are about rendering label....it works for me what it doesn't work is rendering of drawing attributes when using BufferedShapeLayer
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?
----- Messaggio originale -----
Da: JR Andreassen <janrune@io.com>
A: Alessio Iannone <alessio_iannone@yahoo.it>
Inviato: Venerdì 18 aprile 2008, 16:42:40
Oggetto: Re: DbfHandler Hacking to improve performance in rendering road network shape
No worries...
Here is what I hanged in dbfhandler:
--------------------------
public OMGraphic evaluate(int index, OMGraphic omg,
OMGraphicList labelList, Projection proj) {
if (rules == null || rules.size() == 0) {
return omg;
}
try {
List record = dbf.getRecordData(index);
for (Iterator it = rules.iterator(); it.hasNext();) {
Rule rule = (Rule) it.next();
Object recVal = record.get(rule.keyIndex);
if (rule.evaluate(recVal)) {
float scale = proj.getScale();
if (scale < rule.displayMinScale
|| scale > rule.displayMaxScale) {
// We met the rule, it's telling us not to display.
return null;
}
if (rule.infolineIndicies != null) {
omg.putAttribute(OMGraphicConstants.INFOLINE,
getContentFromIndicies(rule.infolineIndicies,
record));
}
if (rule.tooltipIndicies != null) {
omg.putAttribute(OMGraphicConstants.TOOLTIP,
getContentFromIndicies(rule.tooltipIndicies,
record));
}
// ------------------------------------------------
// Chanegd by JR
boolean labelVisibile = true;
if (rule.labelIndicies != null)
{
com.bbn.openmap.omGraphics.OMLabeler label =
(com.bbn.openmap.omGraphics.OMLabeler)omg.getAttribute(OMGraphicConstants.LABEL);
if(scale >=
rule.labelMinScale && scale <= rule.labelMaxScale)
{
String newlabel =
getContentFromIndicies(rule.labelIndicies,
record);
// Check for skip
repeating
if (lastLabel !=
null && lastLabel.equalsIgnoreCase(newlabel))
{ newlabel = null; }
if(newlabel != null)
{
OMTextLabeler
tlabler = null;
String lastlabel
= null;
if(label
instanceof OMTextLabeler)
{ tlabler =
(OMTextLabeler)label;}
if(label == null
&& tlabler == null)
{
label =
tlabler = new OMTextLabeler(newlabel, OMText.JUSTIFY_CENTER);
// Needs to
get added to the OMGraphic so it gets
// generated
with the projection at the right point.
omg.putAttribute(OMGraphicConstants.LABEL, tlabler);
labelList.add(tlabler);
} // new Label
else
{
if(!newlabel.equalsIgnoreCase(tlabler.getData()))
{
tlabler.setData(newlabel);}
}
labelVisibile =
true;
lastLabel =
newlabel;
} // if(newlabel !=
null)
}// if(scale >=
rule.labelMinScale && scale <= rule.labelMaxScale)
else
{ labelVisibile = false;}
if(label != null &&
label instanceof OMGraphic)
{
((OMGraphic)label).setVisible(labelVisibile);}
// Chanegd by JR
// ------------------------------------------------
} // if (rule.labelIndicies != null)
if (rule.da != null) {
rule.da.setTo(omg);
}
break;
}
}
} catch (IOException ioe) {
} catch (FormatException fe) {
}
return omg;
}
--------------------------
> Hi all,
> Trying to develop an application that is capable of rendering road
> network layer based on Esri Shape File and applying to them different
> drawing attributes according to the rule definition
> I have noticed that (AFAIK) there are some problem, ( probably bug or
> probably something that I have not really understand).
> For example if have to write a rule that says to not render road with
> a FRC greater than 4 what I have done to be able to obtain this
> beahoviour, was to modify the code(more or less line 336) in
> com.bbn.openmap.dataAccess.shape.DbfHandler.java
>
> if (rule.da != null) {
> rule.da.setTo(omg);
> }else{
> //FIXME Verify if it is correct...
> //If the drawing attributes are not set this
> mean that I don't want
> //to draw the object...for example assume that
> we don't want to render
> //road with a FRC class greater than 4 we set
> render properties to false...
> //so we have to return a null omg;
> //Otherwise we have to define another property
> to telle explicitely that we don't want
> //rendering occurs....
> //@author Alessio Iannone
> // Debug.output("Rule
> "+rule.getRuleName()+" skipping drawing...");
> omg = null;
> }
> now what is happening is that even if with this hack I am able to
> avoid the call to the OMGraphics generate method, and so I am skipping
> rendering of this kind of road,
> I could not avoid the call to
> factory.makeEsriGraphicFromRecord(entry.getByteOffset(), shp,
> drawingAttributes, pointIcon, byteTracker); in
> com.bbn.openmap.layer.shape.SpatialIndex (line 512).
> I have also noticed that inside the call generated by
> makeEsriGraphicFromRecord every time new object are allocated (like
> ESRIPoint and so on)..I am thinking about introducing bounded Object
> Pool to avoid these numerous allocation but I have to verify where I
> can submit again the object to the Pool Itself (I don't want to
> override the finalize method of the object...i think is not a good idea).
> Basically I am trying to find a way to improve performance in loading
> big network shape file. What do you think about it? Have you better
> suggestion on how I can improve loading of road network shape file?.
> I have also tested the same application whit different kind of layer
> for loading the Map application like MapBean, BufferedMapBean adn
> BufferedLayerMapBean....but the performance doesnt' change and i have
> also some spurious graphics artifacts when not using the MapBean (Like
> map displayed over scrollbar of a JScrollPane container)...furthermore
> I have tried to use BufferedShapeLayer (instead of simple
> ShapeLayer)....now performance are much better but no rules is
> applyied to the shape file.....any hints?
> P.S.
> I am using CVS Version of openmap.
> For JR I have still to try your code for caching the shape
> file...please be patient ;)
> Sorry for my English :(.
>
> *Alessio Iannone*
> Software Engineer
>
> *Mobile:* 39 329 8834960
> *Email:* alessio.iannone@nextant.it <mailto:alessio.iannone@nextant.it>
> *
IM:* quonn77@hotmail.com (AIM)
> *http://www.linkedin.com/in/alessioiannone
> *Web sites of the Martial Arts I play <
http://www.shorinjikempo-ryu.it>* *
> *Nextant - Navcomm Applications* <
http://www.next.it>
> Via Alessandro Noale
> <
http://maps.google.com/maps?q=Via+Alessandro+Noale&hl=en>
>
> See who we know in common <
http://www.linkedin.com/e/wwk/7254039/>
> Want a signature like this? <
http://www.linkedin.com/e/sig/7254039/>
>
>
>
> ------------------------------------------------------------------------
> Inviato da Yahoo! Mail
> <
http://us.rd.yahoo.com/mailuk/taglines/isp/control/*http://us.rd.yahoo.com/evt=52437/*http://it.docs.yahoo.com/mail/overview/index.html>.
>
> La casella di posta intelligente.
Inviato da Yahoo! Mail.
La casella di posta intelligente.
http://it.docs.yahoo.com/mail/overview/index.html
--
[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 Apr 18 2008 - 11:08:23 EDT