/* * 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 ilog.views.IlvPoint; import ilog.views.IlvRect; import ilog.views.graphic.IlvLabel; import ilog.views.graphic.IlvRectangle; import ilog.views.io.IlvOutputStream; import ilog.views.tiling.IlvTile; import ilog.views.tiling.IlvTileLoader; /** * This tile loader generates graphics for a given tile. These graphics are * composed of: - The boundary of the tile - The name of the tile - The * coordinates of the tile */ public class ScaleLodLoader implements IlvTileLoader { /** * This variable stores the layer name */ private String layerName; private int ratioFactor; /** * Constructs a new loader with specified name */ public ScaleLodLoader(String name, int ratio) { layerName = name; ratioFactor = ratio; } /** * Loads the graphic objects for specified tile. For this example, this * simulate loading of data by generating graphic objects */ Override public void load(IlvTile tile) throws Exception { IlvRect bbox = new IlvRect(); tile.boundingBox(bbox); // Add this tile representation tile.addObject(new IlvRectangle(bbox), null); // Add a little text String text = this.layerName + " (" + (tile.getColumn() * ratioFactor) + "," + (tile.getRow() * ratioFactor) + ")"; IlvPoint textCenter = new IlvPoint(bbox.x + bbox.width / 2.0, bbox.y + bbox.height / 2.0); tile.addObject(new IlvLabel(textCenter, text), null); tile.loadComplete(); } /** * Release the objects on this tile */ Override public void release(IlvTile tile) { tile.deleteAll(); } // This loader is not persistent, so these methodes need not to // be active Override public boolean isPersistent() { return false; } Override public void write(IlvOutputStream stream) { } }