CategorizedPoint extends AbstractCategorizedLegend<PointParameters> implements SymbolUom, EnablesStroke, OnVertexOnInterior { @Override public PointParameters get(Object o) { if(!(o instanceof Double)){ throw new IllegalArgumentException("Keys are double values in this map"); } Double d = (Double)o; double w; Color sc; String da; Double sop; if(strokeEnabled){ w = widthStroke.getFromLower(d); sc = colorStroke.getFromLower(d); da = dashStroke.getFromLower(d); sop = opacityStroke.getFromLower(d); } else { w = .0; sc = Color.WHITE; da = ""; sop = .0; } return new PointParameters(sc,sop,w,da, colorFill.getFromLower(d),opacityFill.getFromLower(d), widthSymbol.getFromLower(d),heightSymbol.getFromLower(d),wkn.getFromLower(d)); } CategorizedPoint();  CategorizedPoint(PointSymbolizer sym); @Override List<CategorizedLegend> getCategorizedLegend(); @Override Symbolizer getSymbolizer(); @Override String getLegendTypeName(); @Override PointParameters get(Object o); @Override PointParameters put(Double d, PointParameters pp); @Override PointParameters remove(Object o); @Override boolean isStrokeEnabled(); @Override void setStrokeEnabled(boolean enable); @Override void setFallbackParameters(PointParameters fallback); @Override PointParameters getFallbackParameters(); @Override void setOnVertex(); @Override void setOnInterior(); @Override boolean isOnVertex(); @Override Uom getStrokeUom(); @Override void setStrokeUom(Uom u); @Override Uom getSymbolUom(); @Override void setSymbolUom(Uom u); @Override String getLegendTypeId(); static final String NAME; }
@Test public void testBadInstanciation() throws Exception { Style s = getStyle(PROPORTIONAL_POINT); PointSymbolizer ps = (PointSymbolizer) s.getRules().get(0).getCompositeSymbolizer().getChildren().get(0); try{ CategorizedPoint cp = new CategorizedPoint(ps); fail(); }catch (IllegalArgumentException iae){ assertTrue(true); } }
@Test public void testGet() throws Exception { CategorizedPoint ca = getCategorizedPoint(); PointParameters tester = new PointParameters(Color.decode("#223344"),.2,2.0,"1 1",Color.decode("#113355"),.5,6.0,5.0,"SQUARE"); assertTrue(ca.get(Double.NEGATIVE_INFINITY).equals(tester)); tester = new PointParameters(Color.decode("#dd77ee"),.2,2.0,"1 1",Color.decode("#dd66ee"),.5,7.0,5.0,"STAR"); assertTrue(ca.get(70000.0).equals(tester)); tester = new PointParameters(Color.decode("#dd77ee"),.2,2.0,"1 1",Color.decode("#ffaa99"),.5,8.0,5.0,"CROSS"); assertTrue(ca.get(100000.0).equals(tester)); tester = new PointParameters(Color.decode("#ffaa00"),.2,2.0,"1 1",Color.decode("#ffaa99"),.5,8.0,5.0,"CROSS"); assertTrue(ca.get(110000.0).equals(tester)); }
@Test public void testGetNoStroke() throws Exception { CategorizedPoint ca = getNoStroke(); PointParameters tester = new PointParameters(Color.WHITE,.0,.0,"",Color.decode("#113355"),.5,6.0,5.0,"SQUARE"); assertTrue(ca.get(Double.NEGATIVE_INFINITY).equals(tester)); }
@Test public void testNullViewBox() throws Exception { PointSymbolizer ps = getPointSymbolizer(); MarkGraphic mg = (MarkGraphic) ps.getGraphicCollection().getGraphic(0); mg.setViewBox(null); CategorizedPoint cp = new CategorizedPoint(ps); PointParameters tester = new PointParameters(Color.decode("#223344"),.2,2.0,"1 1",Color.decode("#113355"),.5, MarkGraphic.DEFAULT_SIZE,MarkGraphic.DEFAULT_SIZE,"SQUARE"); assertTrue(cp.get(Double.NEGATIVE_INFINITY).equals(tester)); }
@Test public void testViewBoxNullWidth() throws Exception { PointSymbolizer ps = getPointSymbolizer(); MarkGraphic mg = (MarkGraphic) ps.getGraphicCollection().getGraphic(0); mg.getViewBox().setWidth(null); CategorizedPoint cp = new CategorizedPoint(ps); PointParameters tester = new PointParameters(Color.decode("#223344"),.2,2.0,"1 1",Color.decode("#113355"),.5,5.0,5.0,"SQUARE"); assertTrue(cp.get(Double.NEGATIVE_INFINITY).equals(tester)); }
@Test public void testViewBoxNullHeight() throws Exception { PointSymbolizer ps = getPointSymbolizer(); MarkGraphic mg = (MarkGraphic) ps.getGraphicCollection().getGraphic(0); mg.getViewBox().setHeight(null); CategorizedPoint cp = new CategorizedPoint(ps); PointParameters tester = new PointParameters(Color.decode("#223344"),.2,2.0,"1 1",Color.decode("#113355"),.5,6.0,6.0,"SQUARE"); assertTrue(cp.get(Double.NEGATIVE_INFINITY).equals(tester)); }