001package armyc2.c5isr.renderer.utilities; 002 003import android.graphics.Point; 004import android.graphics.Rect; 005 006 007public class SVGSymbolInfo implements SymbolDimensionInfo{ 008 009 private String _svg = null; 010 private String _svgDataURI = null; 011 012 private int _anchorX = 0; 013 private int _anchorY = 0; 014 private Rect _symbolBounds = null; 015 private Rect _bounds = null; 016 017 public SVGSymbolInfo(String svg, Point anchorPoint, Rect symbolBounds, Rect svgBounds) 018 { 019 _svg = svg; 020 _anchorX = (int)anchorPoint.x; 021 _anchorY = (int)anchorPoint.y; 022 _symbolBounds = symbolBounds; 023 _bounds = svgBounds; 024 } 025 026 public String getSVGDataURI() 027 { 028 if(_svgDataURI==null) 029 { 030 //_svgDataURI = new String(Base64.getEncoder().encode(_svg.getBytes()));//Java 031 _svgDataURI = new String(android.util.Base64.encode(_svg.getBytes(),0)); 032 } 033 return _svgDataURI; 034 } 035 036 public String getSVG(){return _svg;} 037 038 /** 039 * The x value the image should be centered on or the "anchor point". 040 * @return {@link Integer} 041 */ 042 public int getCenterX() 043 { 044 return _anchorX; 045 } 046 047 /** 048 * The y value the image should be centered on or the "anchor point". 049 * @return {@link Integer} 050 */ 051 public int getCenterY() 052 { 053 return _anchorY; 054 } 055 056 /** 057 * The point the image should be centered on or the "anchor point". 058 * @return {@link Point} 059 */ 060 public Point getCenterPoint() 061 { 062 return new Point(_anchorX, _anchorY); 063 } 064 065 /** 066 * minimum bounding rectangle for the core symbol. Does 067 * not include modifiers, display or otherwise. 068 * @return {@link Rect} 069 */ 070 public Rect getSymbolBounds() 071 { 072 return _symbolBounds; 073 } 074 075 /** 076 * Dimension of the entire image. 077 * @return {@link Rect} 078 */ 079 080 public Rect getImageBounds() 081 { 082 return new Rect(_bounds.left,_bounds.top,_bounds.right,_bounds.bottom); 083 } 084 085 086 087}