From: dadar <iam...@ya...> - 2009-10-17 13:30:04
|
> thx jody > what i want is: > 1. how can i create array of Set<FeatureId>?? > > i declared it like this > Set<FeatureId> [] IDs; > after that when i try to fill [] > IDs= new Set<FeatureId> [2]; > there is an error generic array creation > am i wrong when i declared it? > To create a FeatureId you need to use a FilterFactory - but I think > you got that part. > The method should accept a single Set<FeatureId> (not an array of > Set<FeatureId> ). My first reply showed how to create a HashSet; do > you need more information on how to use the java collection classes; > why are you using an array? jody, i'm trying to change some of the class in MapDisplayLab so i can use it for my program like this one: void selectFeatures(double [] posisix, double [] posisiy) so i sent an array of some area position in the map after i calculate it, after this i want to change the color of area based in the position that i sent. In the displaySelectedFeatures we use IDs to set the style so i think maybe i need to make an array of Set<FeatureId> to do it and sent it (change the parameter in displaySelectedFeatures into public void displaySelectedFeatures(Set<FeatureId> [] IDs) ) what do u think? am i wrong with my thought? > 2. how can i change the color of two area in map? > > what i mean is like in MapDisplayClass there is SelectFeature that > change the color of the area when we click it > is same like that but i want two area at the same time change its > color > i tried to change the code like this but only the last IDs that > change the color > how can i set the style of two area at the same time?? > The example method createSelectedStyle( IDs ) is an example. Go into > that method and see how it makes a Style? You will need to make your > own Style; your Style should have two rules; one for each feature you > want to isolate for special treatment; each Rule will have a different > list of symbolizers descrbing how to draw the features that match that > Rule. > You may wish to read the StyleLayerDescriptor specification which > contains examples of how to define a style in xml. I understand that createSelectedStyle (IDs) is method to set style based in IDs before diplaying it in map what i need is how can I set 2 or more IDs style, then displaying it if (IDs.isEmpty()) { style = createDefaultStyle(); mapFrame.getMapContext().getLayer(0).setStyle(style); } else { style = createSelectedStyle(IDs); mapFrame.getMapContext().getLayer(0).setStyle(style); } if (IDs2.isEmpty()) { style = createDefaultStyle(); mapFrame.getMapContext().getLayer(0).setStyle(style); } else { style = createSelectedStyle(IDs2); mapFrame.getMapContext().getLayer(0).setStyle(style); } mapFrame.getMapPane().repaint(); i try to change the source code in displaySelectedFeatures like above so i sent 2 IDs and set the style before i repaint it all i get is only IDs2 color that change into yellow color how do i get both of it (IDs and IDs2) change color into yellow -- View this message in context: http://n2.nabble.com/i-have-problem-to-change-style-in-mapdisplaylab-for-2-IDs-tp3840063p3840739.html Sent from the geotools-gt2-users mailing list archive at Nabble.com. |