/* * Licensed Materials - Property of Perforce Software, Inc. * © Copyright Perforce Software, Inc. 2014, 2021 * © Copyright IBM Corp. 2009, 2014 * © Copyright ILOG 1996, 2009 * All Rights Reserved. * * Note to U.S. Government Users Restricted Rights: * The Software and Documentation were developed at private expense and * are "Commercial Items" as that term is defined at 48 CFR 2.101, * consisting of "Commercial Computer Software" and * "Commercial Computer Software Documentation", as such terms are * used in 48 CFR 12.212 or 48 CFR 227.7202-1 through 227.7202-4, * as applicable. */ import java.awt.Color; import ilog.views.IlvGraphic; import ilog.views.IlvManager; import ilog.views.maps.IlvMapFeature; import ilog.views.maps.IlvMapRenderException; import ilog.views.maps.rendering.IlvDefaultCurveRenderer; import ilog.views.maps.rendering.IlvMapLineRenderingStyle; import ilog.views.maps.srs.coordtrans.IlvCoordinateTransformation; import ilog.views.maps.srs.coordtrans.IlvCoordinateTransformationException; public class RendererSample { IlvManager manager = new IlvManager(); int layerIndex = 0; IlvMapFeature feature; public RendererSample() { IlvMapLineRenderingStyle style = new IlvMapLineRenderingStyle(); style.setForeground(Color.green); style.setLineWidth(4); style.setScale(1f / 1000000f); IlvDefaultCurveRenderer renderer = new IlvDefaultCurveRenderer(); renderer.setLineRenderingStyle(style); try { // Identity transformation. IlvCoordinateTransformation identity = IlvCoordinateTransformation.CreateTransformation(null, null); IlvGraphic graphic = renderer.makeGraphic(feature, identity); // Adding the graphic object into a manager. manager.addObject(graphic, layerIndex, true); } catch (IlvMapRenderException e) { // Might occur if the geometry is not a curve. System.out.println("This renderer cannot translate the map feature"); System.out.println(e.getMessage()); } catch (IlvCoordinateTransformationException te) { // Might occur if the coordinate transformation could not be // performed. System.out.println("This renderer could not transform the geometry"); System.out.println(te.getMessage()); } } }