├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── core ├── JavaLineArray │ ├── applet.policy │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ ├── JavaLineArray │ │ │ ├── CChannelPoints2.java │ │ │ ├── CELineArray.java │ │ │ ├── Channels.java │ │ │ ├── DISMSupport.java │ │ │ ├── POINT2.java │ │ │ ├── Shape2.java │ │ │ ├── TacticalLines.java │ │ │ ├── arraysupport.java │ │ │ ├── countsupport.java │ │ │ ├── flot.java │ │ │ ├── lineutility.java │ │ │ └── ref.java │ │ └── JavaTacticalRenderer │ │ │ ├── Modifier2.java │ │ │ ├── P1.java │ │ │ ├── TGLight.java │ │ │ ├── clsChannelUtility.java │ │ │ ├── clsMETOC.java │ │ │ ├── clsUtility.java │ │ │ └── mdlGeodesic.java │ │ └── resources │ │ ├── CPOF Design Notes.txt │ │ └── visualAssets │ │ ├── BeachSlopeModerate.png │ │ ├── BeachSlopeSteep.png │ │ ├── BeigeStipple.png │ │ ├── FoulGround.png │ │ ├── Kelp.png │ │ ├── OilRigField.png │ │ ├── SweptArea.png │ │ └── Weirs.png ├── JavaRenderer │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── ArmyC2 │ │ └── C2SD │ │ └── Rendering │ │ ├── IJavaRenderer.java │ │ ├── JavaRenderer.java │ │ ├── MultiPointRenderer.java │ │ ├── SinglePointRenderer.java │ │ └── TacticalGraphicIconRenderer.java ├── JavaRendererServer │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── RenderMultipoints │ │ ├── clsClipPolygon2.java │ │ ├── clsClipQuad.java │ │ ├── clsRenderer.java │ │ ├── clsRenderer2.java │ │ ├── clsUtility.java │ │ ├── clsUtilityCPOF.java │ │ └── clsUtilityGE.java ├── JavaRendererUtils │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── ArmyC2 │ │ │ └── C2SD │ │ │ └── Utilities │ │ │ ├── AffiliationColors.java │ │ │ ├── ErrorLogger.java │ │ │ ├── FileHandler.java │ │ │ ├── GeoPixelConversion3D.java │ │ │ ├── IMultiPointRenderer.java │ │ │ ├── IPointConversion.java │ │ │ ├── ImageInfo.java │ │ │ ├── MilStdAttributes.java │ │ │ ├── MilStdSymbol.java │ │ │ ├── ModifiersTG.java │ │ │ ├── ModifiersUnits.java │ │ │ ├── PointConversion.java │ │ │ ├── PointConversionDummy.java │ │ │ ├── PointConverter3D.java │ │ │ ├── RendererException.java │ │ │ ├── RendererSettings.java │ │ │ ├── ShapeInfo.java │ │ │ ├── SinglePointFont.java │ │ │ ├── SinglePointLookup.java │ │ │ ├── SinglePointLookupInfo.java │ │ │ ├── SymbolDef.java │ │ │ ├── SymbolDefTable.java │ │ │ ├── SymbolDisplayProperties.java │ │ │ ├── SymbolDraw.java │ │ │ ├── SymbolExplorerTreeCreator.java │ │ │ ├── SymbolID.java │ │ │ ├── SymbolUtilities.java │ │ │ ├── TBCRendererException.java │ │ │ ├── TacticalGraphicLookup.java │ │ │ ├── UnitDef.java │ │ │ ├── UnitDefTable.java │ │ │ ├── UnitFontLookup.java │ │ │ ├── UnitFontLookupC.java │ │ │ ├── UnitFontLookupInfo.java │ │ │ └── XMLUtil.java │ │ └── resources │ │ ├── FONTS │ │ ├── SinglePoint.ttf │ │ ├── TacticalGraphics.ttf │ │ └── UnitFont.ttf │ │ └── XML │ │ ├── SinglePointB.xml │ │ ├── SinglePointC.xml │ │ ├── SymbolConstantsB.xml │ │ ├── SymbolConstantsC.xml │ │ ├── TacticalGraphics.xml │ │ ├── UnitConstantsB.xml │ │ ├── UnitConstantsC.xml │ │ ├── UnitFontMappingsB.xml │ │ ├── UnitFontMappingsC.xml │ │ └── index layout.txt └── pom.xml ├── documentation ├── JavaRendererUtils apidocs.zip ├── Mil Symbology Web Service Developer's Guide.docx └── mil-sym-renderer apidocs.zip ├── pom.xml ├── renderer ├── RendererPluginInterface │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── ArmyC2 │ │ └── C2SD │ │ └── RendererPluginInterface │ │ ├── ISinglePointInfo.java │ │ ├── ISinglePointRenderer.java │ │ └── SinglePointInfo.java ├── mil-sym-renderer │ ├── pom.xml │ ├── pomJava7.xml │ ├── pomJava8.xml │ └── src │ │ └── main │ │ ├── java │ │ ├── org │ │ │ └── gavaghan │ │ │ │ └── geodesy │ │ │ │ ├── Angle.java │ │ │ │ ├── Ellipsoid.java │ │ │ │ ├── GeodeticCalculator.java │ │ │ │ ├── GeodeticCurve.java │ │ │ │ ├── GeodeticMeasurement.java │ │ │ │ ├── GlobalCoordinates.java │ │ │ │ └── GlobalPosition.java │ │ └── sec │ │ │ ├── geo │ │ │ ├── GeoArc.java │ │ │ ├── GeoBlock.java │ │ │ ├── GeoBlock2.java │ │ │ ├── GeoEllipse.java │ │ │ ├── GeoPath.java │ │ │ ├── GeoPoint.java │ │ │ ├── kml │ │ │ │ ├── KmlOptions.java │ │ │ │ ├── KmlPolygon.java │ │ │ │ ├── KmlRenderer.java │ │ │ │ ├── KmlStyle.java │ │ │ │ └── XsltCoordinateWrapper.java │ │ │ └── shape │ │ │ │ ├── AArc.java │ │ │ │ ├── AComposite.java │ │ │ │ ├── AExtrusion.java │ │ │ │ ├── APath.java │ │ │ │ ├── APivot.java │ │ │ │ ├── Cake.java │ │ │ │ ├── Circle.java │ │ │ │ ├── Ellipse.java │ │ │ │ ├── IArc.java │ │ │ │ ├── ICircle.java │ │ │ │ ├── IPivot.java │ │ │ │ ├── Line.java │ │ │ │ ├── Orbit.java │ │ │ │ ├── Point.java │ │ │ │ ├── Polyarc.java │ │ │ │ ├── Polygon.java │ │ │ │ ├── Radarc.java │ │ │ │ ├── Route.java │ │ │ │ └── Track.java │ │ │ └── web │ │ │ ├── exceptions │ │ │ └── InvalidNumberOfPointsException.java │ │ │ ├── json │ │ │ └── utilities │ │ │ │ ├── HTTPTokener.java │ │ │ │ ├── JSONArray.java │ │ │ │ ├── JSONException.java │ │ │ │ ├── JSONObject.java │ │ │ │ ├── JSONString.java │ │ │ │ └── JSONTokener.java │ │ │ └── renderer │ │ │ ├── AreaSymbolFill.java │ │ │ ├── GeoPixelConversion.java │ │ │ ├── MultiPointHandler.java │ │ │ ├── MultiPointServer.java │ │ │ ├── PointConverter.java │ │ │ ├── SECRenderer.java │ │ │ ├── SECWebRenderer.java │ │ │ ├── Shape3DHandler.java │ │ │ ├── SinglePoint2525Renderer.java │ │ │ ├── SinglePointRendererService.java │ │ │ ├── SinglePointServer.java │ │ │ ├── SymbolModifiers.java │ │ │ ├── UrlTester.java │ │ │ ├── portable │ │ │ ├── PortableWrapper.java │ │ │ └── RendererSystemTray.java │ │ │ └── utilities │ │ │ ├── JavaRendererUtilities.java │ │ │ ├── LineInfo.java │ │ │ ├── PNGInfo.java │ │ │ ├── SinglePointServerTester.java │ │ │ ├── SymbolInfo.java │ │ │ └── TextInfo.java │ │ ├── jnlp │ │ ├── TEMPresources │ │ │ └── mil-sym-renderer.jnlp │ │ └── template.vm │ │ ├── resources │ │ ├── META-INF │ │ │ └── services │ │ │ │ └── ArmyC2.C2SD.RendererPluginInterface.ISinglePointRenderer │ │ ├── assembly │ │ │ └── zipAssembly.xml │ │ ├── images │ │ │ └── globe.png │ │ └── properties │ │ │ └── secrenderer.properties │ │ └── webapp │ │ ├── WEB-INF │ │ └── web.xml │ │ └── index.jsp └── pom.xml ├── samples ├── pom.xml └── rendering-sample-1 │ ├── pom.xml │ ├── readme.md │ └── src │ └── main │ └── java │ └── sec │ └── web │ └── renderer │ └── samples │ ├── Gui.java │ └── gui.form ├── service ├── mil-sym-service │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── sec │ │ │ │ └── web │ │ │ │ └── renderer │ │ │ │ ├── model │ │ │ │ ├── CommonURL.java │ │ │ │ ├── Plugin.java │ │ │ │ ├── PluginData.java │ │ │ │ └── RenderingDataEnums.java │ │ │ │ ├── services │ │ │ │ ├── directory │ │ │ │ │ ├── DirectoryReaderController.java │ │ │ │ │ ├── DirectoryReaderServlet.java │ │ │ │ │ └── listeners │ │ │ │ │ │ ├── DirectoryReaderTaskScheduler.java │ │ │ │ │ │ ├── DirectoryWatcherVJ6.java │ │ │ │ │ │ └── ReadDirectoryTimerTask.java │ │ │ │ ├── imaging │ │ │ │ │ ├── ImageGeneratorController.java │ │ │ │ │ ├── ImageGeneratorServlet.java │ │ │ │ │ └── SECRendererImpl.java │ │ │ │ └── ping │ │ │ │ │ ├── PingServiceController.java │ │ │ │ │ └── PingServiceServlet.java │ │ │ │ └── utils │ │ │ │ ├── DirectoryReaderUtils.java │ │ │ │ ├── ImagingUtils.java │ │ │ │ ├── IoUtilities.java │ │ │ │ ├── MultiPointUtils.java │ │ │ │ └── ResourceUtils.java │ │ ├── resources │ │ │ ├── assembly │ │ │ │ └── zip.xml │ │ │ └── properties │ │ │ │ └── prop.properties │ │ └── webapp │ │ │ ├── WEB-INF │ │ │ ├── dispatch-servlet.xml │ │ │ ├── web.xml │ │ │ └── wro │ │ │ │ ├── wro.properties │ │ │ │ └── wro.xml │ │ │ ├── WebServiceSinglePoints.html │ │ │ ├── css │ │ │ ├── images │ │ │ │ ├── ui-bg_flat_0_aaaaaa_40x100.png │ │ │ │ ├── ui-bg_flat_100_262b30_40x100.png │ │ │ │ ├── ui-bg_flat_100_646c76_40x100.png │ │ │ │ ├── ui-bg_flat_100_747c88_40x100.png │ │ │ │ ├── ui-bg_flat_100_8892a1_40x100.png │ │ │ │ ├── ui-bg_flat_75_646c76_40x100.png │ │ │ │ ├── ui-bg_glass_55_fbf9ee_1x400.png │ │ │ │ ├── ui-bg_inset-soft_95_fef1ec_1x100.png │ │ │ │ ├── ui-icons_2e83ff_256x240.png │ │ │ │ ├── ui-icons_cd0a0a_256x240.png │ │ │ │ └── ui-icons_ffffff_256x240.png │ │ │ ├── jquery-ui-1.8.23.custom.css │ │ │ ├── min │ │ │ │ └── mil-symbology-renderer-all.css │ │ │ └── test │ │ │ │ ├── imageTbl.css │ │ │ │ ├── images │ │ │ │ ├── armyRanks.jpg │ │ │ │ ├── armyStar.jpg │ │ │ │ ├── back.png │ │ │ │ ├── bullet_green.png │ │ │ │ ├── bullet_red.png │ │ │ │ ├── button_bg.gif │ │ │ │ ├── cecom-logo.png │ │ │ │ └── input_bg.gif │ │ │ │ ├── jquery-ui-1.9.1.custom.css │ │ │ │ ├── js │ │ │ │ ├── jquery-1.8.2.js │ │ │ │ └── jquery-ui-1.9.1.custom.js │ │ │ │ └── main.css │ │ │ ├── index.jsp │ │ │ ├── jquery-2.1.0.min.js │ │ │ ├── js │ │ │ ├── jquery-1.8.0.min.js │ │ │ ├── jquery-ui-1.8.23.custom.min.js │ │ │ ├── jquery.dynatree.min.js │ │ │ ├── json2.js │ │ │ ├── mil-symbology-api-validation.js │ │ │ ├── mil-symbology-messaging.debug.js │ │ │ ├── mil-symbology-renderer.debug.js │ │ │ ├── skin-vista │ │ │ │ ├── icons.gif │ │ │ │ ├── loading.gif │ │ │ │ └── ui.dynatree.css │ │ │ └── skin │ │ │ │ ├── icons.gif │ │ │ │ ├── loading.gif │ │ │ │ ├── ui.dynatree.css │ │ │ │ └── vline.gif │ │ │ ├── multiPoints.html │ │ │ ├── multiPoints2.html │ │ │ ├── rpc_relay.uncompressed.html │ │ │ ├── singlePoints.html │ │ │ ├── symbology-renderer-api-validation.html │ │ │ ├── symbology-renderer-widget.html │ │ │ └── test-index.jsp │ │ └── test │ │ ├── java │ │ └── test │ │ │ └── sec │ │ │ └── web │ │ │ └── renderer │ │ │ └── imaging │ │ │ ├── SpringImagingTests.java │ │ │ ├── TestImagingUtils.java │ │ │ └── test-dispatch-servlet.xml │ │ └── resources │ │ └── test-dispatch-servlet.xml └── pom.xml └── travis ├── release.sh └── settings.xml /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Package Files # 4 | *.jar 5 | *.war 6 | *.ear 7 | 8 | 9 | target/ 10 | build/ 11 | dist/ 12 | tester/ 13 | 14 | *.settings 15 | *.project 16 | *.classpath -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: java 3 | 4 | jdk: 5 | - oraclejdk8 6 | 7 | env: 8 | global: 9 | - secure: KFePqeS7LybLDrMZjMofn4reP5E15SaAQCEkcwPQSf80SeHC2cDQqI0EfRIZJeWgU3jezuGP8fbo6bfCNoLyC2IFzOoE2pd9zZ9WiImMzG+nNBdBvI3OeH6qDtygrC23lUGh8Um2GxrR5g5iAZUGqOsoosp2yr4YS3qRLw8eOWDDiyIBy+DYiEp6bnDzqqtuCyVpHhkD5nrYSx2lIaVwsahweJU9vtHrXN84SbrDq/mEbLA7QposVdj8NGGcp2jM8syKR/TRZGCLo1Z46+TGmOPFnNcSYqYqNsCUKYMqo0Pfi6gTS/dlXmKzhrSkpXRKl81SklkyYvqieyh9cm4FQORnc8hhCFihXraltjTOUlZ+S58xSyQ2ZIGoQpWM5KsmvFgdJ0/+fcckSnb7Vk+boOnMvJcbXsFeoJRFU+kMmZRFYM9xANG7wMfxNmuXvOdZEIwrS3Z3J/LkJpGo3KAzoXwdFZaX9Hwl6o61g/BQKCq5I5ngBd6T39q+9om+TEGHEC7GLcsPenSF7lPiI84M9+lMpNNNLLMYfdnr+zvKfGI0qhj6iomqUc7QE1Am1WhwLBzLrQtqS9tCWiwHqrnxwQind4W7022YY0pPUdpZbVlqYbQanzZN4TSQVo8wbAsWfzLyyeHmrKHz5w/cCAPMJpix9wRnYP2muv99+0X5OcE= 10 | - secure: EK5rtN8rN4i7+84gmWOQlskn1IiREFDIi9pgEzkAYRVWgg3tMnGT+7niO8+OKWWdsGn4btOBvAQgPImP/1H3JhBTXk+25LNlZOAcY7LFDmmpiNHtYf0AY3CL8WKBaqNpYOwbArwqyFLW0wik83DsZboujc43kHkZoYwLaPFXydl3fQChLNcNmoGTfHAzEigGazv5ZoT8o03puBlaG8MI7ArI5Dr19cpKFU0u8NlUwq6dQ0yOfhIUzyX1rJ12SNLFlEPLwK4kyP6uUheTSgTuOKjdPM4pXpulKrduYWta73vvTS4S76IoPSg4vEOh2oxvK/s2BfWwYKuTQhm98I2IWQdy4GgmtsTX8vTyNxC/PxYKhaeauRvL3I/Dh5k6AW1CenlqqAyX4eBOMDaAquqkT6LWhMAgxNjRFAyhIWxScGUnFHtCaClPlVSdVhWckaHFtvPgLCCpnFaFYo/FORjmrGd+zpiCUQjaVJ18BKnVQzLdW3acvcyOlQS/wA6ieeRk04OgR3PIFMLniEwz7TuDhw27+fT9q2QKfVg/UTZZ2yvDC62OGE2SMTDiU8hf4+jDumxtqaJ+ftc218ubCamgmLnmdBerxxX9sv8uQzWMR173KcSPP7Dv/cEDwyKKwkr8z3emGYqsUjbx3bVfhGFB55AoqHvXcqP51qRchqC11CY= 11 | 12 | cache: 13 | directories: 14 | - "$HOME/.m2" 15 | 16 | install: 17 | - mvn clean install --settings travis/settings.xml -e 18 | 19 | deploy: # travis by default will not invoke this step for PRs 20 | - provider: releases 21 | skip_cleanup: true 22 | api_key: 23 | secure: T3iHm37PiONulKrrF7SdQMbm424YDe2sRwYl6eIkxoG0wBhFhWLVjFu/Xw4IVCgtdmGSCbtUHzLHN/gqhzvxilCtH1Mt9gTm3Mxr/xGY9iXTWn9PC/9+hZx/45XTQ7Ev8MufpUud1Y6yyPttXSIswCtL5SeXeQjYi2quwRcxd4V304lX/t8ap/3vezFsWaQ6AD/5ChNAlmiJchIA2TDA/CRy9aDQBCKMmADMORhTHkzcTmxxAFqTFEbfuHCVtnxiygdoIFFY5bHwton1EXrbzYIiModbY3/z+ZZcXt526EuEDpAn5GIA+RcQVI4cK8zWcpzWi+0+Xx7UzmuA8yiq0D8ZsQJ0Z4m3TVXELvOjipv3mdyHw4wIugIrJMtS8YKc5LWzmdeK+xBB4NXyeRo0LQvUrVexMlnR6G59qpEn9DLnPzirTXtNoMXGwb1t2kwGGVGp7LYrTxJIbRJLm6qBygwjrekc6+kegJ9r2GsjR4L3w2/JOlctJEJusMk1iMiVOuBUnkb2BxWCFBfqF0j6X3IpC4eew6htZ+KNCQGe7EnWbdGrUoqzHoF7pi/Dze2NwcIrkDfu5TS+Uo55cV4iodWuMGBqqTYO+4IvOr5lcug6kC4Z+xVVsB+8KDBICkHS8NZ/RgofDKnngStqVRkD0TQ+uCni8beZnltUCgLV44Q= 24 | file_glob: true 25 | file: 26 | - renderer/mil-sym-renderer/target/mil-sym-renderer-*.zip 27 | - service/mil-sym-service/target/mil-sym-service-*.war 28 | on: 29 | tags: true 30 | condition: "$TRAVIS_TAG =~ ^v[0-9]+.[0-9]+.[0-9]+$" 31 | - provider: script 32 | skip_cleanup: true 33 | script: travis/release.sh 34 | on: 35 | tags: true 36 | condition: "$TRAVIS_TAG =~ ^v[0-9]+.[0-9]+.[0-9]+$" 37 | 38 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # mil-sym-java 2 | 3 | [![Build Status](https://travis-ci.org/missioncommand/mil-sym-java.svg?branch=master)](https://travis-ci.org/missioncommand/mil-sym-java) 4 | 5 | 6 | About 7 | ----------- 8 | mil-sym-java is a well worn set of java libraries that have been used in US Army Mission Command software for years. In November 2013 Mission Command was given the approval to release and maintain these libraries as public open source. 9 | 10 | [Developer's Guide Wiki](https://github.com/missioncommand/mil-sym-java/wiki/Developer's-Guide) 11 | [Google Group Discussion Forum](https://groups.google.com/forum/#!forum/mission-command-milstd-renderer) 12 | 13 | See new project for 2525D+ rendering: 14 | [mil-sym-java](https://github.com/missioncommand/mil-sym-java) 15 | 16 | MIL-STD-2525 17 | ----------- 18 | The [MIL-STD-2525] standard defines how to visualize military symbology. This project provides support for the entire MIL-STD-2525B Change II plus USAS 13-14 and MIL-STD-2525C. 19 | 20 | Project Structure 21 | ------------ 22 | mil-sym-java is a project that contains three distinct components: 23 | - Core: The low level libraries for generating complex line and polygon based symbols such as tactical graphics. This component is not intended to be used directly. This project outputs a set of jar files. 24 | 25 | - Renderer: This is the component that can be used in Java applications to generate the entire MIL-STD-2525 symbol for both icons based symbols and geometric symbols such as tactical graphics. Renderer relies on the jar files generated by Core. 26 | 27 | - Service: This component uses the Core and Renderer jar files and creates a REST web service interface that can be deployed to a Java servlet container such as: 28 | 29 | - Apache Tomcat 30 | - JBOSS 31 | - WebLogic 32 | - Jetty 33 | 34 | 35 | 36 | 37 | Version 38 | ---- 39 | Updated to deploy on MavenCentral. 40 | Search for mil-sym-renderer. 41 | groupdID changed to io.github.missioncommand 42 | 43 | https://s01.oss.sonatype.org/#nexus-search;quick~mil-sym-renderer 44 | 45 | https://s01.oss.sonatype.org/#nexus-search;quick~mil-sym-service 46 | 47 | Also: 48 | 49 | https://search.maven.org/search?q=a:mil-sym-renderer 50 | 51 | https://search.maven.org/search?q=a:mil-sym-service 52 | 53 | Tech 54 | ----------- 55 | 56 | mil-sym-java project uses a handful of open source projects to work properly: 57 | 58 | * [Maven] - Open source Apache build manager for Java projects 59 | * [jQuery] - A fast, small, and feature-rich JavaScript library 60 | 61 | Build 62 | -------------- 63 | This project builds with Maven. The output of the core and renderer project is a set of JAR files and the service project outputs a WAR file as described under project structure. A top level parent pom file builds all the projects in the correct order with a single command. 64 | 65 | Open a command prompt to the root folder of the repository on your local machine and enter: 66 | ```sh 67 | mvn clean install 68 | ``` 69 | 70 | License 71 | ---- 72 | 73 | Apache License 74 | Version 2.0, January 2004 75 | http://www.apache.org/licenses/ 76 | 77 | [Maven]: http://maven.apache.org/ 78 | [jQuery]: http://jQuery.com 79 | [MIL-STD-2525]:http://www.everyspec.com/MIL-STD/MIL-STD-2000-2999/MIL-STD-2525_20727/ 80 | 81 | 82 | -------------------------------------------------------------------------------- /core/JavaLineArray/applet.policy: -------------------------------------------------------------------------------- 1 | grant { 2 | permission java.security.AllPermission; 3 | }; 4 | -------------------------------------------------------------------------------- /core/JavaLineArray/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | io.github.missioncommand 6 | mil-sym-java 7 | 0.1.43 8 | ../.. 9 | 10 | 11 | JavaLineArray 12 | jar 13 | mil-sym-java :: Core :: JavaLineArray 14 | 15 | 16 | 17 | io.github.missioncommand 18 | JavaRendererUtils 19 | 20 | 21 | 22 | junit 23 | junit 24 | test 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /core/JavaLineArray/src/main/java/JavaLineArray/CChannelPoints2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package JavaLineArray; 7 | 8 | /** 9 | * A class for channel points used by clsChannelUtility 10 | * @author Michael Deutch 11 | */ 12 | public class CChannelPoints2 13 | { 14 | protected POINT2 m_Line1; 15 | protected POINT2 m_Line2; 16 | protected CChannelPoints2() 17 | { 18 | m_Line1=new POINT2(); 19 | m_Line2=new POINT2(); 20 | } 21 | protected CChannelPoints2(CChannelPoints2 pts) 22 | { 23 | m_Line1=new POINT2(pts.m_Line1); 24 | m_Line2=new POINT2(pts.m_Line2); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /core/JavaLineArray/src/main/java/JavaLineArray/POINT2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package JavaLineArray; 7 | 8 | /** 9 | * Class to provide a Point object with a linestyle to facilitate drawing. 10 | * @author Michael Deutch 11 | */ 12 | public class POINT2 13 | { 14 | public double x; 15 | public double y; 16 | public int style; 17 | public int segment; 18 | public POINT2(double x, double y) 19 | { 20 | this.x=x; 21 | this.y=y; 22 | this.style=0; 23 | } 24 | public POINT2(double x, double y, int segment, int style) 25 | { 26 | this.x=x; 27 | this.y=y; 28 | this.segment=segment; 29 | this.style=style; 30 | } 31 | public POINT2(double x, double y, int style) 32 | { 33 | this.x=x; 34 | this.y=y; 35 | this.style=style; 36 | } 37 | public POINT2(POINT2 pt) 38 | { 39 | this.x=pt.x; 40 | this.y=pt.y; 41 | this.segment=pt.segment; 42 | this.style=pt.style; 43 | } 44 | public POINT2() 45 | { 46 | this.x=0; 47 | this.y=0; 48 | this.style=0; 49 | } 50 | } 51 | 52 | -------------------------------------------------------------------------------- /core/JavaLineArray/src/main/java/JavaLineArray/Shape2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package JavaLineArray; 6 | import java.awt.geom.GeneralPath; 7 | import java.awt.Stroke; 8 | import java.awt.BasicStroke; 9 | import java.awt.geom.AffineTransform; 10 | import ArmyC2.C2SD.Utilities.ShapeInfo; 11 | /** 12 | * A class to extend ShapeInfo suitable for point calculations. 13 | * @author Michael Deutch. 14 | */ 15 | public class Shape2 extends ShapeInfo 16 | { 17 | 18 | public Shape2(int value) 19 | { 20 | setShapeType(value); 21 | _Shape=new GeneralPath(); 22 | AffineTransform tx=new AffineTransform(); 23 | tx.setToIdentity(); 24 | Stroke stroke=new BasicStroke(); 25 | this.setStroke(stroke); 26 | this.setAffineTransform(tx); 27 | } 28 | private int style=0; //e.g. 26 for enemy flots 29 | public void set_Style(int value) 30 | { 31 | style = value; 32 | } 33 | private int fillStyle; 34 | public void set_Fillstyle(int value) 35 | { 36 | fillStyle=value; 37 | } 38 | public int get_FillStyle() 39 | { 40 | return fillStyle; 41 | } 42 | public int get_Style() //used by TacticalRenderer but not client 43 | { 44 | return style; 45 | } 46 | public void lineTo(POINT2 pt) 47 | { 48 | ((GeneralPath)_Shape).lineTo(pt.x, pt.y); 49 | } 50 | public void moveTo(POINT2 pt) 51 | { 52 | ((GeneralPath)_Shape).moveTo(pt.x, pt.y); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /core/JavaLineArray/src/main/java/JavaLineArray/ref.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package JavaLineArray; 7 | 8 | /** 9 | * A class to enable functions to pass parameters by reference 10 | * @author Michael Deutch 11 | */ 12 | public class ref { 13 | public T value; 14 | } 15 | -------------------------------------------------------------------------------- /core/JavaLineArray/src/main/java/JavaTacticalRenderer/P1.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package JavaTacticalRenderer; 7 | 8 | /** 9 | * Class used by channels for dtermining segments. Segments are used by 10 | * clsChannelUtility to handle double-backed segments so that the lines 11 | * will not go off the display area. 12 | * 13 | * @author Michael Deutch 14 | */ 15 | public class P1 { 16 | public int start; 17 | public int end_Renamed; 18 | } 19 | -------------------------------------------------------------------------------- /core/JavaLineArray/src/main/resources/CPOF Design Notes.txt: -------------------------------------------------------------------------------- 1 | CPOF Notes 2 | 3 | CONTAIN: use N modifier or "ENY" for the label 4 | LC: the only linetype whose shapes linecolor get set in Channels (red for style==25) 5 | 6 | FONT property in props.set_Attribute is a Font object and not a string, per Peter's example 7 | 8 | CElineArray.CGetLinetypeFromString added section at the top for generic symbol names for test purposes. These strings will not be passed byt the CPOF client. 9 | 10 | Modifier2.AddModifiers adds the modifiers based on the client pixels. Addmodifiers2 adds modifiers based on the calculated pixels. For Example BLOCK requires the calculated pixels. 11 | clsRenderGraphic.render is the render function for which the plugin is a pass-thru 12 | 13 | 14 | Areas: Only one shape object is used for both fill and the outline. Some lines have additional shapes for fill, e.g. FERRY has 2 additional fill shapes for the 9,9,10 style sequence for the arrowheads. 15 | 16 | 17 | clsRenderer2.ResolveModifierShape 18 | is an override for shapes requiring specific styles. In general shape styles are set using tg properties. But some tg's have multiple shapes so the style cannot be set until after arraysupport or Channels has calculated the pixels and built the shapes based on the those pixels. The flag that is set by these functions is shape type which ResolveModifierShape uses to determine if it is a fill or an outline. 19 | 20 | Shapes are built from calculated pixels at the bottom of these functions: Channels.GetChannel1Double, arraysupport.GetLineArray2Double, and clsUtility.Change1TacticalAreas. The general approach is to loop through the pixels looking for linestyles which determine whether it is a new shape, start of a new line (moveTo),continuation of a line, (lineTo), or the completion of a shape (shapes.add(Shape)). It sets the shape type as a flag for subsequent functions. 21 | 22 | 32 bits. If clean and build fails and it says it cannot compile one of the occulus clases it is because of the wrong version of Java (1.5). Must set the jdk to 1.6. -------------------------------------------------------------------------------- /core/JavaLineArray/src/main/resources/visualAssets/BeachSlopeModerate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/core/JavaLineArray/src/main/resources/visualAssets/BeachSlopeModerate.png -------------------------------------------------------------------------------- /core/JavaLineArray/src/main/resources/visualAssets/BeachSlopeSteep.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/core/JavaLineArray/src/main/resources/visualAssets/BeachSlopeSteep.png -------------------------------------------------------------------------------- /core/JavaLineArray/src/main/resources/visualAssets/BeigeStipple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/core/JavaLineArray/src/main/resources/visualAssets/BeigeStipple.png -------------------------------------------------------------------------------- /core/JavaLineArray/src/main/resources/visualAssets/FoulGround.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/core/JavaLineArray/src/main/resources/visualAssets/FoulGround.png -------------------------------------------------------------------------------- /core/JavaLineArray/src/main/resources/visualAssets/Kelp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/core/JavaLineArray/src/main/resources/visualAssets/Kelp.png -------------------------------------------------------------------------------- /core/JavaLineArray/src/main/resources/visualAssets/OilRigField.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/core/JavaLineArray/src/main/resources/visualAssets/OilRigField.png -------------------------------------------------------------------------------- /core/JavaLineArray/src/main/resources/visualAssets/SweptArea.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/core/JavaLineArray/src/main/resources/visualAssets/SweptArea.png -------------------------------------------------------------------------------- /core/JavaLineArray/src/main/resources/visualAssets/Weirs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/core/JavaLineArray/src/main/resources/visualAssets/Weirs.png -------------------------------------------------------------------------------- /core/JavaRenderer/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | io.github.missioncommand 6 | mil-sym-java 7 | 0.1.43 8 | ../.. 9 | 10 | 11 | JavaRenderer 12 | jar 13 | mil-sym-java :: Core :: JavaRenderer 14 | 15 | 16 | 17 | io.github.missioncommand 18 | JavaRendererServer 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /core/JavaRenderer/src/main/java/ArmyC2/C2SD/Rendering/MultiPointRenderer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package ArmyC2.C2SD.Rendering; 6 | 7 | import ArmyC2.C2SD.Utilities.IMultiPointRenderer; 8 | import ArmyC2.C2SD.Utilities.IPointConversion; 9 | import ArmyC2.C2SD.Utilities.MilStdSymbol; 10 | import ArmyC2.C2SD.Utilities.ModifiersTG; 11 | import ArmyC2.C2SD.Utilities.RendererSettings; 12 | import ArmyC2.C2SD.Utilities.ShapeInfo; 13 | import ArmyC2.C2SD.Utilities.SymbolDraw; 14 | import ArmyC2.C2SD.Utilities.SymbolUtilities; 15 | import RenderMultipoints.clsRenderer; 16 | import java.util.ArrayList; 17 | 18 | /** 19 | * 20 | * @author michael.spinelli 21 | */ 22 | public class MultiPointRenderer implements IMultiPointRenderer { 23 | 24 | private static MultiPointRenderer _instance = null; 25 | 26 | public static synchronized MultiPointRenderer getInstance() 27 | { 28 | if(_instance == null) 29 | _instance = new MultiPointRenderer(); 30 | 31 | return _instance; 32 | } 33 | 34 | @Override 35 | public MilStdSymbol render(MilStdSymbol symbol, IPointConversion converter, Object clipBounds) { 36 | 37 | try 38 | { 39 | 40 | //RenderMultipoints.clsRenderer.render(symbol, converter); 41 | //TGLight tgl = new TGLight(); 42 | 43 | //sector range fan, make sure there is a minimum distance value. 44 | if(SymbolUtilities.getBasicSymbolID(symbol.getSymbolID()).equals("G*F*AXS---****X")) 45 | { 46 | if(symbol.getModifiers_AM_AN_X(ModifiersTG.AN_AZIMUTH)!=null && 47 | symbol.getModifiers_AM_AN_X(ModifiersTG.AM_DISTANCE)!=null) 48 | { 49 | int anCount = symbol.getModifiers_AM_AN_X(ModifiersTG.AN_AZIMUTH).size(); 50 | int amCount = symbol.getModifiers_AM_AN_X(ModifiersTG.AM_DISTANCE).size(); 51 | ArrayList am = null; 52 | if(amCount < ((anCount/2) + 1)) 53 | { 54 | am = symbol.getModifiers_AM_AN_X(ModifiersTG.AM_DISTANCE); 55 | if(am.get(0)!=0.0) 56 | { 57 | am.add(0, 0.0); 58 | } 59 | } 60 | } 61 | } 62 | 63 | //call that supports clipping 64 | 65 | 66 | 67 | ArrayList modifiers = null; 68 | RenderMultipoints.clsRenderer.render(symbol, converter, clipBounds); 69 | modifiers = symbol.getModifierShapes(); 70 | 71 | if(RendererSettings.getInstance().getTextBackgroundMethod() 72 | != RendererSettings.TextBackgroundMethod_NONE) 73 | { 74 | modifiers = SymbolDraw.ProcessModifierBackgrounds(modifiers); 75 | symbol.setModifierShapes(modifiers); 76 | } 77 | 78 | } 79 | catch(Exception exc) 80 | { 81 | String message = "Failed to build multipoint TG"; 82 | if(symbol != null) 83 | message = message + ": " + symbol.getSymbolID(); 84 | //ErrorLogger.LogException(this.getClass().getName() ,"ProcessTGSymbol()", 85 | // new RendererException(message, exc)); 86 | System.err.println(exc.getMessage()); 87 | } 88 | catch(Throwable t) 89 | { 90 | String message2 = "Failed to build multipoint TG"; 91 | if(symbol != null) 92 | message2 = message2 + ": " + symbol.getSymbolID(); 93 | //ErrorLogger.LogException(this.getClass().getName() ,"ProcessTGSymbol()", 94 | // new RendererException(message2, t)); 95 | System.err.println(t.getMessage()); 96 | } 97 | 98 | return symbol; 99 | } 100 | 101 | @Override 102 | public MilStdSymbol renderWithPolylines(MilStdSymbol symbol, IPointConversion converter, Object clipBounds) { 103 | clsRenderer.renderWithPolylines(symbol, converter, clipBounds); 104 | return symbol; 105 | } 106 | 107 | } 108 | -------------------------------------------------------------------------------- /core/JavaRendererServer/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | io.github.missioncommand 6 | mil-sym-java 7 | 0.1.43 8 | ../.. 9 | 10 | 11 | JavaRendererServer 12 | jar 13 | mil-sym-java :: Core :: JavaRendererServer 14 | 15 | 16 | 17 | io.github.missioncommand 18 | JavaLineArray 19 | 20 | 21 | 22 | junit 23 | junit 24 | test 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /core/JavaRendererUtils/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | io.github.missioncommand 6 | mil-sym-java 7 | 0.1.43 8 | ../.. 9 | 10 | 11 | JavaRendererUtils 12 | jar 13 | mil-sym-java :: Core :: JavaRendererUtils 14 | 15 | 16 | 17 | junit 18 | junit 19 | test 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /core/JavaRendererUtils/src/main/java/ArmyC2/C2SD/Utilities/AffiliationColors.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package ArmyC2.C2SD.Utilities; 7 | 8 | import java.awt.Color; 9 | 10 | /** 11 | * 12 | * @author michael.spinelli 13 | */ 14 | public class AffiliationColors { 15 | 16 | /// 17 | /// Friendly Unit Fill Color. 18 | /// 19 | public static Color FriendlyUnitFillColor = new Color(128,224,255); 20 | /// 21 | /// Hostile Unit Fill Color. 22 | /// 23 | public static Color HostileUnitFillColor = new Color(255,128,128);//new Color(255,130,132);//Color.RED; 24 | /// 25 | /// Neutral Unit Fill Color. 26 | /// 27 | public static Color NeutralUnitFillColor = new Color(170,255,170);//new Color(144,238,144);//Color.GREEN;//new Color(0,255,0);//new Color(144,238,144);//light green//Color.GREEN;new Color(0,226,0); 28 | /// 29 | /// Unknown Unit Fill Color. 30 | /// 31 | public static Color UnknownUnitFillColor = new Color(255,255,128);// new Color(255,255,128);//Color.YELLOW; 32 | 33 | /// 34 | /// Friendly Graphic Fill Color. 35 | /// 36 | public static Color FriendlyGraphicFillColor = new Color(128,224,255);//Crystal Blue //Color.CYAN; 37 | /// 38 | /// Hostile Graphic Fill Color. 39 | /// 40 | public static Color HostileGraphicFillColor = new Color(255,128,128);//salmon 41 | /// 42 | /// Neutral Graphic Fill Color. 43 | /// 44 | public static Color NeutralGraphicFillColor = new Color(170,255,170);//Bamboo Green //new Color(144,238,144);//light green 45 | /// 46 | /// Unknown Graphic Fill Color. 47 | /// 48 | public static Color UnknownGraphicFillColor = new Color(255,255,128);//light yellow new Color(255,255,224);//light yellow 49 | 50 | /// 51 | /// Friendly Unit Line Color. 52 | /// 53 | public static Color FriendlyUnitLineColor = Color.BLACK; 54 | /// 55 | /// Hostile Unit Line Color. 56 | /// 57 | public static Color HostileUnitLineColor = Color.BLACK; 58 | /// 59 | /// Neutral Unit Line Color. 60 | /// 61 | public static Color NeutralUnitLineColor = Color.BLACK; 62 | /// 63 | /// Unknown Unit Line Color. 64 | /// 65 | public static Color UnknownUnitLineColor = Color.BLACK; 66 | 67 | /// 68 | /// Friendly Graphic Line Color. 69 | /// 70 | public static Color FriendlyGraphicLineColor = Color.BLACK; 71 | /// 72 | /// Hostile Graphic Line Color. 73 | /// 74 | public static Color HostileGraphicLineColor = Color.RED; 75 | /// 76 | /// Neutral Graphic Line Color. 77 | /// 78 | public static Color NeutralGraphicLineColor = Color.GREEN; 79 | /// 80 | /// Unknown Graphic Line Color. 81 | /// 82 | public static Color UnknownGraphicLineColor = Color.YELLOW; 83 | 84 | public static Color WeatherRed = new Color(198,16,33);//0xC61021;// 198,16,33 85 | public static Color WeatherBlue = new Color(0,0,255);//0x0000FF;// 0,0,255 86 | 87 | public static Color WeatherPurpleDark = new Color(128,0,128);//0x800080;// 128,0,128 Plum Red 88 | public static Color WeatherPurpleLight = new Color(226,159,255);//0xE29FFF;// 226,159,255 Light Orchid 89 | 90 | public static Color WeatherBrownDark = new Color(128,98,16);//0x806210;// 128,98,16 Safari 91 | public static Color WeatherBrownLight = new Color(210,176,106);//0xD2B06A;// 210,176,106 Khaki 92 | 93 | } 94 | -------------------------------------------------------------------------------- /core/JavaRendererUtils/src/main/java/ArmyC2/C2SD/Utilities/FileHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package ArmyC2.C2SD.Utilities; 7 | 8 | import java.io.ByteArrayOutputStream; 9 | import java.io.FileInputStream; 10 | import java.io.InputStream; 11 | 12 | 13 | 14 | /** 15 | * 16 | * @author michael.spinelli 17 | */ 18 | public class FileHandler { 19 | 20 | static public String fileToString(String inFile) 21 | { 22 | return new String(fileToBytes(inFile)); 23 | } 24 | 25 | static public byte[] fileToBytes(String inFile) 26 | { 27 | FileInputStream fis = null; 28 | try 29 | { 30 | fis = new FileInputStream(inFile); 31 | } 32 | catch(Throwable thrown) 33 | { 34 | } 35 | return inputStreamToBytes(fis); 36 | } 37 | 38 | static public String InputStreamToString(InputStream inFile) 39 | { 40 | return new String(InputStreamToBytes(inFile)); 41 | } 42 | 43 | static public byte[] InputStreamToBytes(InputStream inFile) 44 | { 45 | return inputStreamToBytes(inFile); 46 | } 47 | 48 | static public byte[] inputStreamToBytes(InputStream is) 49 | { 50 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); 51 | try 52 | { 53 | byte[] bytes = new byte[8192]; 54 | int size = is.read(bytes); 55 | while(size > 0) 56 | { 57 | baos.write(bytes, 0, size); 58 | size = is.read(bytes); 59 | } 60 | } 61 | catch(Throwable thrown) 62 | { 63 | } 64 | finally 65 | { 66 | if(is != null) 67 | { 68 | try 69 | { 70 | is.close(); 71 | } 72 | catch(Throwable thrown) 73 | { 74 | } 75 | } 76 | } 77 | return (baos.toByteArray()); 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /core/JavaRendererUtils/src/main/java/ArmyC2/C2SD/Utilities/GeoPixelConversion3D.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package ArmyC2.C2SD.Utilities; 7 | 8 | /** 9 | * 10 | * 11 | */ 12 | public class GeoPixelConversion3D 13 | { 14 | private static double inchPerMeter = 39.3700787; 15 | private static double pixelsPerInch = 96 ; 16 | private static double METERS_PER_DEG = 111319.49079327357264771338267056; 17 | 18 | public static double metersPerPixel(double scale) 19 | { 20 | double step1 = scale/pixelsPerInch; 21 | return step1/inchPerMeter; 22 | } 23 | 24 | public static double lat2y(double latitude, double scale, double latOrigin, double metPerPix) 25 | { 26 | 27 | double latRem = Math.abs(latitude-latOrigin); 28 | double pixDis = 0; 29 | if(latRem > 0) 30 | { 31 | pixDis = (latRem*METERS_PER_DEG)/metPerPix; 32 | if(latitude > latOrigin)//was < M. Deutch 6-20-11 33 | { 34 | pixDis = -pixDis; 35 | } 36 | } 37 | return pixDis; 38 | } 39 | 40 | public static double y2lat(double yPosition, double scale, double latOrigin, double metPerPix) 41 | { 42 | 43 | double latitude = latOrigin; 44 | if(yPosition != 0) 45 | { 46 | latitude = latOrigin - ((yPosition * metPerPix)/METERS_PER_DEG) ;//was + M. Deutch 6-18-11 47 | } 48 | return latitude; 49 | } 50 | 51 | public static double long2x(double longitude,double scale,double longOrigin,double latitude, double metPerPix) 52 | { 53 | 54 | double longRem = Math.abs(longitude-longOrigin); 55 | double metersPerDeg = GetMetersPerDegAtLat(latitude); 56 | double pixDis = 0; 57 | if(longRem > 0) 58 | { 59 | pixDis = (longRem*metersPerDeg)/metPerPix; 60 | if(longitude < longOrigin) 61 | { 62 | pixDis = -pixDis; 63 | } 64 | } 65 | return pixDis; 66 | } 67 | 68 | public static double x2long(double xPosition,double scale,double longOrigin,double latitude, double metPerPix) 69 | { 70 | 71 | double metersPerDeg = GetMetersPerDegAtLat(latitude); 72 | double longitude = longOrigin; 73 | if(xPosition != 0) 74 | { 75 | longitude = longOrigin + ((xPosition * metPerPix)/metersPerDeg) ; 76 | } 77 | return longitude; 78 | } 79 | 80 | 81 | public static double Deg2Rad(double deg) 82 | { 83 | double conv_factor = (2.0 * Math.PI)/360.0; 84 | return(deg * conv_factor); 85 | } 86 | 87 | public static double GetMetersPerDegAtLat(double lat) 88 | { 89 | // Convert latitude to radians 90 | lat = Deg2Rad(lat); 91 | // Set up "Constants" 92 | double p1 = 111412.84; // longitude calculation term 1 93 | 94 | double p2 = -93.5; // longitude calculation term 2 95 | 96 | double p3 = 0.118; // longitude calculation term 3 97 | 98 | // Calculate the length of a degree of longitude in meters at given latitude 99 | double longlen = (p1 * Math.cos(lat)) + (p2 * Math.cos(3 * lat)) + (p3 * Math.cos(5 * lat)); 100 | 101 | return longlen; 102 | } 103 | 104 | 105 | } 106 | -------------------------------------------------------------------------------- /core/JavaRendererUtils/src/main/java/ArmyC2/C2SD/Utilities/IMultiPointRenderer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package ArmyC2.C2SD.Utilities; 7 | 8 | /** 9 | * 10 | * 11 | */ 12 | public interface IMultiPointRenderer { 13 | 14 | 15 | /** 16 | * Takes a MilStdSymbol populated with the symbol code, coordinates, 17 | * and modifiers and builds & assigns the shape objects: 18 | * symbolShapes & modifierShapes 19 | * @param symbol 20 | * @param converter 21 | * @param clipBounds Rectangle2D, Rectangle2D.Double, or ArrayList 22 | * @return 23 | */ 24 | public MilStdSymbol render(MilStdSymbol symbol, IPointConversion converter, Object clipBounds); 25 | 26 | /** 27 | * Takes a MilStdSymbol populated with the symbol code, coordinates, 28 | * and modifiers and builds & assigns the shape objects: 29 | * symbolShapes & modifierShapes. It additionally populates the 30 | * Polylines (ArrayList>)in each shapeInfo object 31 | * in the SymbolShapes arraylist of ShapeInfo objects. Useful for when not 32 | * rendering on a java form. I.E., generating kml or json. 33 | * @param symbol 34 | * @param converter 35 | * @param clipBounds Rectangle2D, Rectangle2D.Double, or ArrayList 36 | * @return 37 | */ 38 | public MilStdSymbol renderWithPolylines(MilStdSymbol symbol, IPointConversion converter, Object clipBounds); 39 | 40 | 41 | 42 | } 43 | -------------------------------------------------------------------------------- /core/JavaRendererUtils/src/main/java/ArmyC2/C2SD/Utilities/IPointConversion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package ArmyC2.C2SD.Utilities; 7 | 8 | import java.awt.geom.Point2D; 9 | import java.awt.Point; 10 | 11 | /** 12 | * Interface for Point Conversion objects. Recommend using the functions 13 | * that take and return Point2D objects. 14 | * @author michael.spinelli 15 | */ 16 | public interface IPointConversion { 17 | 18 | // public void UpdateExtents(int pixelWidth, int pixelHeight, 19 | // double geoTop, double geoLeft, 20 | // double geoBottom, double geoRight); 21 | 22 | // public Point2D.Double PixelsToGeo(Point pixel); 23 | 24 | // public Point GeoToPixels(Point2D.Double coord); 25 | 26 | public Point2D PixelsToGeo(Point2D pixel); 27 | 28 | public Point2D GeoToPixels(Point2D coord); 29 | 30 | // public int getPixelWidth(); 31 | // 32 | // public int getPixelHeight(); 33 | // public double getUpperLat(); 34 | // 35 | // public double getLowerLat(); 36 | // 37 | // public double getLeftLon(); 38 | // 39 | // public double getRightLon(); 40 | 41 | 42 | } 43 | -------------------------------------------------------------------------------- /core/JavaRendererUtils/src/main/java/ArmyC2/C2SD/Utilities/MilStdAttributes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package ArmyC2.C2SD.Utilities; 6 | 7 | import java.util.ArrayList; 8 | 9 | /** 10 | * Symbol attributes for use as url parameters 11 | * @author michael.spinelli 12 | */ 13 | public class MilStdAttributes { 14 | 15 | /* 16 | * Line color of the symbol. hex value. 17 | */ 18 | public static final String LineColor = "LINECOLOR"; 19 | 20 | /* 21 | * Fill color of the symbol. hex value 22 | */ 23 | public static final String FillColor = "FILLCOLOR"; 24 | 25 | /** 26 | * Used to change the icon from its normally black color. 27 | */ 28 | public static final String IconColor = "ICONCOLOR"; 29 | 30 | /* 31 | * Fill color of the symbol. hex value 32 | */ 33 | public static final String TextColor = "TEXTCOLOR"; 34 | 35 | /* 36 | * Fill color of the symbol. hex value 37 | */ 38 | public static final String TextBackgroundColor = "TEXTBACKGROUNDCOLOR"; 39 | 40 | /* 41 | * size of the single point image 42 | */ 43 | public static final String PixelSize = "SIZE"; 44 | 45 | /* 46 | * scale value to grow or shrink single point tactical graphics. 47 | */ 48 | public static final String Scale = "SCALE"; 49 | 50 | /** 51 | * defaults to true 52 | */ 53 | public static final String KeepUnitRatio = "KEEPUNITRATIO"; 54 | 55 | /* 56 | * transparency value of the symbol. values from 0-255 57 | */ 58 | public static final String Alpha = "ALPHA"; 59 | 60 | /* 61 | * outline the symbol, true/false 62 | */ 63 | public static final String OutlineSymbol = "OUTLINESYMBOL"; 64 | 65 | /* 66 | * specify and outline color rather than letting renderer picking 67 | * the best contrast color. hex value 68 | */ 69 | public static final String OutlineColor = "OUTLINECOLOR"; 70 | 71 | /* 72 | * 2525B vs 2525C. 73 | * like: 74 | * RendererSettings.Symbology_2525Bch2_USAS_13_14 75 | * OR 76 | * RendererSettings.Symbology_2525C 77 | */ 78 | public static final String SymbologyStandard = "SYMSTD"; 79 | 80 | public static final String Renderer = "RENDERER"; 81 | 82 | public static final String LookAtTag = "LOOKAT"; 83 | 84 | /** 85 | * AGL or MSL typically 86 | */ 87 | public static final String AltitudeMode = "ALTMODE"; 88 | 89 | /** 90 | * If false, the renderer will create a bunch of little lines to create 91 | * the "dash" effect (expensive but necessary for KML). 92 | * If true, it will be on the user to create the dash effect using the 93 | * DashArray from the Stroke object from the ShapeInfo object. 94 | */ 95 | public static final String UseDashArray = "USEDASHARRAY"; 96 | 97 | public static final String UsePatternFill = "USEPATTERNFILL"; 98 | 99 | public static final String PatternFillType = "PATTERNFILLTYPE"; 100 | 101 | 102 | /** 103 | * for singlepoints, if set to "true", no labels will be drawn and you 104 | * will just get the core symbol. 105 | */ 106 | public static final String DrawAsIcon = "ICON"; 107 | 108 | public static final String HideOptionalLabels = "HIDEOPTIONALLABELS"; 109 | 110 | public static ArrayList GetModifierList() 111 | { 112 | ArrayList list = new ArrayList(); 113 | 114 | list.add(LineColor); 115 | list.add(FillColor); 116 | list.add(PixelSize); 117 | list.add(Scale); 118 | list.add(KeepUnitRatio); 119 | list.add(Alpha); 120 | list.add(OutlineSymbol); 121 | list.add(OutlineColor); 122 | list.add(SymbologyStandard); 123 | 124 | return list; 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /core/JavaRendererUtils/src/main/java/ArmyC2/C2SD/Utilities/PointConversionDummy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package ArmyC2.C2SD.Utilities; 7 | 8 | import java.awt.Point; 9 | import java.awt.geom.Point2D; 10 | 11 | /** 12 | * Makes no change to the passed points. Useful for when the points 13 | * are already in pixels. 14 | * @author michael.spinelli 15 | */ 16 | public class PointConversionDummy implements IPointConversion { 17 | 18 | 19 | public PointConversionDummy() 20 | { 21 | } 22 | 23 | public Point2D.Double PixelsToGeo(Point pixel) 24 | { 25 | Point2D.Double coords = new Point2D.Double(); 26 | 27 | coords.x = pixel.x; 28 | coords.y = pixel.y; 29 | 30 | return coords; 31 | } 32 | 33 | public Point GeoToPixels(Point2D.Double coord) 34 | { 35 | Point pixel = new Point(); 36 | 37 | pixel.x = (int)coord.x; 38 | 39 | pixel.y = (int)coord.y; 40 | 41 | return pixel; 42 | } 43 | 44 | public Point2D PixelsToGeo(Point2D pixel) 45 | { 46 | Point2D.Double coords = new Point2D.Double(); 47 | 48 | coords.x = pixel.getX(); 49 | coords.y = pixel.getY(); 50 | 51 | return coords; 52 | } 53 | 54 | public Point2D GeoToPixels(Point2D coord) 55 | { 56 | Point2D.Double pixel = new Point2D.Double(); 57 | 58 | pixel.x = coord.getX(); 59 | pixel.y = coord.getY(); 60 | 61 | return pixel; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /core/JavaRendererUtils/src/main/java/ArmyC2/C2SD/Utilities/PointConverter3D.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package ArmyC2.C2SD.Utilities; 7 | 8 | //import sec.web.renderer.GeoPixelConversion3D; 9 | import java.awt.geom.Point2D; 10 | import java.awt.Point; 11 | /** 12 | * 13 | * @author Michael Deutch 14 | */ 15 | public class PointConverter3D implements IPointConversion 16 | { 17 | private double _controlLat=0; 18 | private double _controlLong=0; 19 | private double _scale=0; 20 | private double _metersPerPixel=0; 21 | public PointConverter3D(double controlLong, double controlLat, double scale) 22 | { 23 | try 24 | { 25 | this._controlLat=controlLat; 26 | this._controlLong=controlLong; 27 | this._scale=scale; 28 | _metersPerPixel=GeoPixelConversion3D.metersPerPixel(scale); 29 | } 30 | catch(Error e) 31 | { 32 | throw e; 33 | } 34 | } 35 | public Point2D.Double PixelsToGeo(Point pixel) 36 | { 37 | Point2D.Double pt2dGeo=null; 38 | try 39 | { 40 | double y=GeoPixelConversion3D.y2lat(pixel.getY(), _scale, _controlLat, _metersPerPixel); 41 | double x=GeoPixelConversion3D.x2long(pixel.getX(), _scale, _controlLong, y, _metersPerPixel); 42 | pt2dGeo=new Point2D.Double(x,y); 43 | } 44 | catch(Error e) 45 | { 46 | throw e; 47 | } 48 | return pt2dGeo; 49 | } 50 | 51 | public Point GeoToPixels(Point2D.Double coord) 52 | { 53 | Point ptPixels=null; 54 | try 55 | { 56 | double y=GeoPixelConversion3D.lat2y(coord.getY(), _scale, _controlLat, _metersPerPixel); 57 | double x=GeoPixelConversion3D.long2x(coord.getX(), _scale, _controlLong, coord.getY(), _metersPerPixel); 58 | ptPixels=new Point(); 59 | ptPixels.setLocation(x, y); 60 | } 61 | catch(Error e) 62 | { 63 | throw e; 64 | } 65 | return ptPixels; 66 | } 67 | 68 | public Point2D PixelsToGeo(Point2D pixel) 69 | { 70 | Point2D.Double pt2dGeo=null; 71 | try 72 | { 73 | double y=GeoPixelConversion3D.y2lat(pixel.getY(), _scale, _controlLat, _metersPerPixel); 74 | double x=GeoPixelConversion3D.x2long(pixel.getX(), _scale, _controlLong, y, _metersPerPixel); 75 | pt2dGeo=new Point2D.Double(x,y); 76 | } 77 | catch(Error e) 78 | { 79 | throw e; 80 | } 81 | return pt2dGeo; 82 | } 83 | 84 | public Point2D GeoToPixels(Point2D coord) 85 | { 86 | Point2D.Double pt2DPixels=null; 87 | try 88 | { 89 | double y=GeoPixelConversion3D.lat2y(coord.getY(), _scale, _controlLat, _metersPerPixel); 90 | double x=GeoPixelConversion3D.long2x(coord.getX(), _scale, _controlLong, coord.getY(), _metersPerPixel); 91 | pt2DPixels=new Point2D.Double(x, y); 92 | } 93 | catch(Error e) 94 | { 95 | throw e; 96 | } 97 | return pt2DPixels; 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /core/JavaRendererUtils/src/main/java/ArmyC2/C2SD/Utilities/RendererException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package ArmyC2.C2SD.Utilities; 7 | 8 | /** 9 | * 10 | * @author michael.spinelli 11 | */ 12 | public class RendererException extends Exception { 13 | 14 | public RendererException(String message) 15 | { 16 | super(message); 17 | } 18 | 19 | public RendererException(String message, Throwable cause) 20 | { 21 | super(cause.getMessage() + " - " + message, cause); 22 | } 23 | 24 | public RendererException(Throwable cause) 25 | { 26 | super(cause); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /core/JavaRendererUtils/src/main/java/ArmyC2/C2SD/Utilities/SinglePointLookupInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package ArmyC2.C2SD.Utilities; 6 | 7 | /** 8 | * 9 | * @author michael.spinelli 10 | */ 11 | public class SinglePointLookupInfo { 12 | 13 | private String _SymbolID = ""; 14 | private String _Description = ""; 15 | private int _mappingP = 0; 16 | private int _mappingA = 0; 17 | private int _height = 0; 18 | private int _width = 0; 19 | 20 | public SinglePointLookupInfo(String basicSymbolID, String description, 21 | String mappingP, String mappingA,String width,String height) 22 | { 23 | _SymbolID = basicSymbolID; 24 | _Description = description; 25 | if(mappingP != null && mappingP.equals("") == false) 26 | _mappingP = Integer.valueOf(mappingP); 27 | if(mappingA != null && mappingA.equals("") == false) 28 | _mappingA = Integer.valueOf(mappingA); 29 | if(height != null && height.equals("") == false) 30 | _height = Integer.valueOf(height); 31 | if(width != null && width.equals("") == false) 32 | _width = Integer.valueOf(width); 33 | } 34 | 35 | public String getBasicSymbolID() 36 | { 37 | return _SymbolID; 38 | } 39 | 40 | public String getDescription() 41 | { 42 | return _Description; 43 | } 44 | 45 | public int getMappingP() 46 | { 47 | return _mappingP; 48 | } 49 | 50 | public int getMappingA() 51 | { 52 | return _mappingA; 53 | } 54 | 55 | public int getHeight() 56 | { 57 | return _height; 58 | } 59 | 60 | public int getWidth() 61 | { 62 | return _width; 63 | } 64 | 65 | /** 66 | * 67 | * @return The newly cloned SPSymbolDef 68 | */ 69 | @Override 70 | public SinglePointLookupInfo clone() 71 | { 72 | SinglePointLookupInfo defReturn; 73 | defReturn = new SinglePointLookupInfo(_SymbolID, _Description, 74 | String.valueOf(getMappingP()), 75 | String.valueOf(getMappingA()), 76 | String.valueOf(getWidth()), 77 | String.valueOf(getHeight())); 78 | return defReturn; 79 | } 80 | 81 | public String toXML() 82 | { 83 | String symbolId = "" + getBasicSymbolID() + ""; 84 | String mappingP = "" + String.valueOf(getMappingP()) + ""; 85 | String mappingA = "" + String.valueOf(getMappingA()) + ""; 86 | String description = "" + getDescription() + ""; 87 | String width = "" + String.valueOf(getWidth()) + ""; 88 | String height = "" + String.valueOf(getHeight()) + ""; 89 | 90 | String xml = symbolId + mappingP + mappingA + description + width + height; 91 | return xml; 92 | } 93 | 94 | } 95 | -------------------------------------------------------------------------------- /core/JavaRendererUtils/src/main/java/ArmyC2/C2SD/Utilities/SymbolDisplayProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package ArmyC2.C2SD.Utilities; 7 | 8 | import java.awt.Color; 9 | 10 | 11 | /** 12 | * 13 | * @author michael.spinelli 14 | * @deprecated 15 | */ 16 | public class SymbolDisplayProperties { 17 | 18 | private Color _FillColor = null; 19 | private Color _LineColor = null; 20 | private String _FillStyle = null; 21 | private String _LineType = null; 22 | private int _LineWidth = -1; 23 | 24 | public SymbolDisplayProperties() { 25 | } 26 | 27 | public Color getFillColor() { 28 | return _FillColor; 29 | } 30 | 31 | public String getFillStyle() { 32 | return _FillStyle; 33 | } 34 | 35 | public Color getLineColor() { 36 | return _LineColor; 37 | } 38 | 39 | public int getLineWidth() { 40 | return _LineWidth; 41 | } 42 | 43 | public void setFillColor(Color fillColor) { 44 | _FillColor = fillColor; 45 | } 46 | 47 | public void setFillStyle(String style) { 48 | _FillStyle = style; 49 | } 50 | 51 | public void setLineColor(Color lineColor) { 52 | _LineColor = lineColor; 53 | } 54 | 55 | public void setLineWidth(int width) { 56 | _LineWidth = width; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /core/JavaRendererUtils/src/main/java/ArmyC2/C2SD/Utilities/TBCRendererException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package ArmyC2.C2SD.Utilities; 7 | 8 | /** 9 | * 10 | * @author michael.spinelli 11 | * @deprecated use RendererException 12 | */ 13 | public class TBCRendererException extends Exception { 14 | 15 | public TBCRendererException(String message, Throwable cause) 16 | { 17 | super(message, cause); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /core/JavaRendererUtils/src/main/java/ArmyC2/C2SD/Utilities/TacticalGraphicLookup.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package ArmyC2.C2SD.Utilities; 6 | 7 | import java.io.InputStream; 8 | import java.util.ArrayList; 9 | import java.util.HashMap; 10 | import java.util.Map; 11 | import java.util.logging.Level; 12 | 13 | /** 14 | * 15 | * @author michael.spinelli 16 | */ 17 | public class TacticalGraphicLookup { 18 | 19 | private ArrayList alSymbolID = new ArrayList(); 20 | private ArrayList alMapping = new ArrayList(); 21 | 22 | private Map lookup = new HashMap(); 23 | 24 | private static TacticalGraphicLookup _instance = null; 25 | 26 | private TacticalGraphicLookup() 27 | { 28 | init(); 29 | } 30 | 31 | public static synchronized TacticalGraphicLookup getInstance() 32 | { 33 | if(_instance == null) 34 | { 35 | _instance = new TacticalGraphicLookup(); 36 | } 37 | return _instance; 38 | } 39 | 40 | /** 41 | * @name init 42 | * 43 | * @desc Simply calls xmlLoaded 44 | * 45 | * @return None 46 | */ 47 | private void init() 48 | { 49 | xmlLoaded(); 50 | } 51 | 52 | /** 53 | * @name xmlLoaded 54 | * 55 | * @desc 56 | * 57 | * @param event - IN - Not used 58 | * @return None 59 | */ 60 | private void xmlLoaded() 61 | { 62 | InputStream xmlStream = this.getClass().getClassLoader().getResourceAsStream("XML/TacticalGraphics.xml"); 63 | String lookupXml = FileHandler.InputStreamToString(xmlStream); 64 | populateLookup(lookupXml); 65 | } 66 | 67 | /** 68 | * @name populateLookup 69 | * 70 | * @desc 71 | * 72 | * @param xml - IN - 73 | * @return None 74 | */ 75 | private void populateLookup(String xml) 76 | { 77 | ArrayList al = XMLUtil.getItemList(xml, "", ""); 78 | for(int i = 0; i < al.size(); i++) 79 | { 80 | String data = (String)al.get(i); 81 | 82 | String basicID = XMLUtil.parseTagValue(data, "", ""); 83 | //String description = XMLUtil.parseTagValue(data, "", ""); 84 | String mapping = XMLUtil.parseTagValue(data, "", ""); 85 | 86 | mapping = checkMappingIndex(mapping); 87 | 88 | //System.out.println(basicID + ": " + mapping); 89 | lookup.put(basicID, Integer.parseInt(mapping)); 90 | 91 | } 92 | } 93 | 94 | /** 95 | * Until XML files are updated, we need to shift the index 96 | * @param index 97 | * @return 98 | */ 99 | private static String checkMappingIndex(String index) 100 | { 101 | int i = -1; 102 | if(SymbolUtilities.isNumber(index)) 103 | { 104 | i = Integer.valueOf(index); 105 | 106 | return String.valueOf(i + 57000); 107 | } 108 | return index; 109 | } 110 | 111 | /** 112 | * given the milstd symbol code, find the font index for the symbol. 113 | * @param symbolCode 114 | * @return 115 | */ 116 | public int getCharCodeFromSymbol(String symbolCode) 117 | { 118 | int symStd = RendererSettings.getInstance().getSymbologyStandard(); 119 | 120 | return getCharCodeFromSymbol(symbolCode, symStd); 121 | } 122 | public int getCharCodeFromSymbol(String symbolCode, int symStd) 123 | { 124 | 125 | try 126 | { 127 | 128 | String basicID = symbolCode; 129 | int charCode = -1; 130 | if(SymbolUtilities.isWeather(symbolCode)==false) 131 | { 132 | basicID = SymbolUtilities.getBasicSymbolID(symbolCode); 133 | } 134 | if(lookup.containsKey(basicID)) 135 | { 136 | charCode = lookup.get(basicID); 137 | if(charCode == 59053) 138 | { 139 | if(symStd == 1) 140 | { 141 | charCode = 59052; 142 | } 143 | } 144 | } 145 | return charCode; 146 | } 147 | catch(Exception exc) 148 | { 149 | ErrorLogger.LogException("TacticalGraphicLookup", "getCharCodeFromSymbol", exc, Level.WARNING); 150 | } 151 | return -1; 152 | 153 | } 154 | 155 | } 156 | -------------------------------------------------------------------------------- /core/JavaRendererUtils/src/main/java/ArmyC2/C2SD/Utilities/UnitDef.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package ArmyC2.C2SD.Utilities; 7 | 8 | /** 9 | * 10 | * @author michael.spinelli 11 | */ 12 | public class UnitDef { 13 | 14 | 15 | 16 | 17 | String basicSymbolId; 18 | String description; 19 | public void UnitDef() 20 | { 21 | //Set fields to their default values. 22 | basicSymbolId = ""; 23 | description = ""; 24 | } 25 | 26 | /** 27 | * @name Clone 28 | * 29 | * @desc Gets around the fact that Flex passes non-primitive data types (e.g. int, string) as by ref. So 30 | * clone creates a new object of this instance of UnitDef 31 | * 32 | * @param none 33 | * @return The newly cloned UnitDef 34 | */ 35 | public UnitDef Clone() 36 | { 37 | UnitDef defReturn = new UnitDef(); 38 | defReturn.setBasicSymbolId(this.getBasicSymbolId()); 39 | defReturn.setDescription(this.getDescription()); 40 | defReturn.setDrawCategory(this.getDrawCategory()); 41 | defReturn.setHierarchy(this.getHierarchy()); 42 | 43 | return defReturn; 44 | } 45 | 46 | /** 47 | * The basic 15 character basic symbol Id. 48 | */ 49 | private String _strBasicSymbolId; 50 | public String getBasicSymbolId() 51 | { 52 | return _strBasicSymbolId; 53 | } 54 | 55 | /** 56 | * @private 57 | */ 58 | public void setBasicSymbolId(String value) 59 | { 60 | _strBasicSymbolId = value; 61 | } 62 | 63 | /** 64 | * The description of this tactical graphic. Typically the name of the tactical graphic in MIL-STD-2525B. 65 | */ 66 | private String _strDescription; 67 | public String getDescription() 68 | { 69 | return _strDescription; 70 | } 71 | 72 | /** 73 | * @private 74 | */ 75 | public void setDescription(String value) 76 | { 77 | _strDescription = value; 78 | } 79 | 80 | private int _intDrawCategory = 0; 81 | /** 82 | * 8 is singlepoint unit, 0 is category 83 | * (do not draw because it's just a category node in the tree) 84 | * @return 85 | */ 86 | public int getDrawCategory() 87 | { 88 | return _intDrawCategory; 89 | } 90 | 91 | /** 92 | * 93 | */ 94 | public void setDrawCategory(int value) 95 | { 96 | _intDrawCategory = value; 97 | } 98 | 99 | /** 100 | * Defines where the symbol goes in the ms2525 hierarchy. 101 | * 2.X.whatever 102 | */ 103 | private String _strHierarchy; 104 | public String getHierarchy() 105 | { 106 | return _strHierarchy; 107 | } 108 | 109 | /** 110 | * @private 111 | */ 112 | public void setHierarchy(String value) 113 | { 114 | _strHierarchy = value; 115 | } 116 | 117 | /** 118 | * Defines where the symbol goes in the ms2525 hierarchy. 119 | * STBOPS.INDIV.WHATEVER 120 | */ 121 | private String _strAlphaHierarchy; 122 | public String getAlphaHierarchy() 123 | { 124 | return _strAlphaHierarchy; 125 | } 126 | 127 | /** 128 | * @private 129 | */ 130 | public void setAlphaHierarchy(String value) 131 | { 132 | _strAlphaHierarchy = value; 133 | } 134 | 135 | private String _strFullPath = ""; 136 | /** 137 | * Defines where the symbol goes in the ms2525 hierarchy. 138 | * Warfighting/something/something 139 | */ 140 | public String getFullPath() 141 | { 142 | return _strFullPath; 143 | } 144 | 145 | /** 146 | * 147 | */ 148 | public void setFullPath(String value) 149 | { 150 | _strFullPath = value; 151 | } 152 | 153 | } 154 | -------------------------------------------------------------------------------- /core/JavaRendererUtils/src/main/java/ArmyC2/C2SD/Utilities/UnitFontLookupInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package ArmyC2.C2SD.Utilities; 7 | 8 | import java.awt.Color; 9 | 10 | /* 11 | 12 | S*G*UCRX--***** 13 | Reconnaissance Long Range Surveillance (LRS) 14 | 1457 15 | 1458 16 | 1459 17 | 1460 18 | 19 | 20 | 21 | 22 | */ 23 | /** 24 | * 25 | * @author Michael.Spinelli 26 | */ 27 | public class UnitFontLookupInfo { 28 | 29 | public String _SymbolID = ""; 30 | public String _Description = ""; 31 | public int _mapping1 = 0; 32 | public int _mapping1U = 0; 33 | public int _mapping1F = 0; 34 | public int _mapping1N = 0; 35 | public int _mapping1H = 0; 36 | public int _mapping2 = 0; 37 | public Color _color1 = Color.BLACK; 38 | public Color _color2 = Color.BLACK; 39 | 40 | public UnitFontLookupInfo(String SymbolID, String Description, 41 | int M1U, int M1F, int M1N, int M1H, Color Color1, int M2, Color Color2 ) 42 | { 43 | _SymbolID = SymbolID; 44 | _Description = Description; 45 | 46 | _mapping1U = M1U; 47 | _mapping1F = M1F; 48 | _mapping1N = M1N; 49 | _mapping1H = M1H; 50 | _mapping2 = M2; 51 | 52 | _color1 = Color1; 53 | _color2 = Color2; 54 | } 55 | 56 | public UnitFontLookupInfo(String SymbolID, String Description, 57 | String M1U, String M1F, String M1N, String M1H, String Color1, 58 | String M2, String Color2) 59 | { 60 | _SymbolID = SymbolID; 61 | _Description = Description; 62 | 63 | if(M1U != null && !M1U.equals("")) 64 | _mapping1U = Integer.valueOf(M1U); 65 | if(M1F != null && !M1F.equals("")) 66 | _mapping1F = Integer.valueOf(M1F); 67 | if(M1N != null && !M1N.equals("")) 68 | _mapping1N = Integer.valueOf(M1N); 69 | if(M1H != null && !M1H.equals("")) 70 | _mapping1H = Integer.valueOf(M1H); 71 | if(M2 != null && !M2.equals("")) 72 | _mapping2 = Integer.valueOf(M2); 73 | 74 | Color temp = null; 75 | if(Color1 != null && !Color1.equals("")) 76 | temp = SymbolUtilities.getColorFromHexString(Color1); 77 | if(temp != null) 78 | _color1 = temp; 79 | if(Color2 != null && !Color2.equals("")) 80 | _color2 = SymbolUtilities.getColorFromHexString(Color2); 81 | } 82 | 83 | public String getBasicSymbolID() 84 | { 85 | return _SymbolID; 86 | } 87 | 88 | public String getDescription() 89 | { 90 | return _Description; 91 | } 92 | 93 | /** 94 | * gives correct mapping given the full 95 | * @param SymbolID 96 | * @return 97 | */ 98 | public int getMapping1(String SymbolID) 99 | { 100 | char affiliation = SymbolID.charAt(1); 101 | if(affiliation == 'F' || 102 | affiliation == 'A' || 103 | affiliation == 'D' || 104 | affiliation == 'M' || 105 | affiliation == 'J' || 106 | affiliation == 'K') 107 | return _mapping1F; 108 | else if(affiliation == 'H' || affiliation == 'S') 109 | return _mapping1H; 110 | if(affiliation == 'N' || affiliation == 'L') 111 | return _mapping1N; 112 | else /*(affiliation == 'P' || 113 | affiliation == 'U' || 114 | affiliation == 'G' || 115 | affiliation == 'W')*/ 116 | return _mapping1U; 117 | } 118 | 119 | public int getMapping2() 120 | { 121 | return _mapping2; 122 | } 123 | 124 | public Color getColor1() 125 | { 126 | return _color1; 127 | } 128 | 129 | public Color getColor2() 130 | { 131 | return _color2; 132 | } 133 | 134 | } 135 | -------------------------------------------------------------------------------- /core/JavaRendererUtils/src/main/java/ArmyC2/C2SD/Utilities/XMLUtil.java: -------------------------------------------------------------------------------- 1 | package ArmyC2.C2SD.Utilities; 2 | 3 | import java.util.ArrayList; 4 | 5 | /** 6 | * 7 | * @author michael.spinelli 8 | */ 9 | public class XMLUtil { 10 | 11 | public static final String SymbolConstantsB = "XML/SymbolConstantsB.xml"; 12 | public static final String SymbolConstantsC = "XML/SymbolConstantsC.xml"; 13 | 14 | public static final String SinglePointB = "XML/SinglePointB.xml"; 15 | public static final String SinglePointC = "XML/SinglePointC.xml"; 16 | 17 | public static final String UnitConstantsB = "XML/UnitConstantsB.xml"; 18 | public static final String UnitConstantsC = "XML/UnitConstantsC.xml"; 19 | 20 | public static final String UnitFontMappingsB = "XML/UnitFontMappingsB.xml"; 21 | public static final String UnitFontMappingsC = "XML/UnitFontMappingsC.xml"; 22 | 23 | public static final String TacticalGraphics = "XML/TacticalGraphics.xml"; 24 | 25 | 26 | 27 | /** 28 | * This method returns the list of objects in a list form. 29 | * 30 | * @param xml 31 | * @param startTag 32 | * @param endTag 33 | * @return 34 | */ 35 | public static ArrayList getItemList(String xml, String startTag, String endTag) { 36 | ArrayList list = new ArrayList(); 37 | 38 | String value = null; 39 | try { 40 | int index = xml.indexOf(startTag); 41 | int index2 = 0; 42 | while (xml != null && index > -1 && index2 > -1) { 43 | index2 = xml.indexOf(endTag, index); 44 | if (index2 > -1) { 45 | value = xml.substring(index, index2 + endTag.length()); 46 | list.add(value); 47 | xml = xml.substring(index2 + endTag.length()); 48 | index = xml.indexOf(startTag); 49 | } 50 | } 51 | } catch (Throwable thrown) { 52 | } 53 | return list; 54 | } 55 | 56 | /** 57 | * This method parse the xml tag value. 58 | * 59 | * @param xml 60 | * @param tag 61 | * @param endTag 62 | * @return 63 | */ 64 | public static String parseTagValue(String xml, String tag, String endTag) { 65 | String val = ""; 66 | try { 67 | int index1 = xml.indexOf(tag) + tag.length(); 68 | int index2 = xml.indexOf(endTag, index1); 69 | if (index1 > -1 && index2 > -1) { 70 | val = xml.substring(index1, index2); 71 | } 72 | } catch (Throwable thrown) { 73 | val = null; 74 | } 75 | return val; 76 | } 77 | 78 | /** 79 | * This method changes the value of the xml. 80 | * 81 | * @param xml 82 | * @param tag 83 | * @param endTag 84 | * @param value 85 | * @return 86 | */ 87 | public static String changeTagValue(String xml, String tag, String endTag, String value) { 88 | int offset = 0; 89 | String v = value; 90 | while (xml.indexOf(tag, offset) > -1) { 91 | offset = xml.indexOf(tag, offset); 92 | int endoffset = xml.indexOf(endTag, offset); 93 | // Replace value 94 | xml = xml.substring(0, offset + tag.length()) + v + xml.substring(endoffset); 95 | offset = endoffset; 96 | } 97 | return xml; 98 | } 99 | 100 | 101 | } 102 | -------------------------------------------------------------------------------- /core/JavaRendererUtils/src/main/resources/FONTS/SinglePoint.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/core/JavaRendererUtils/src/main/resources/FONTS/SinglePoint.ttf -------------------------------------------------------------------------------- /core/JavaRendererUtils/src/main/resources/FONTS/TacticalGraphics.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/core/JavaRendererUtils/src/main/resources/FONTS/TacticalGraphics.ttf -------------------------------------------------------------------------------- /core/JavaRendererUtils/src/main/resources/FONTS/UnitFont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/core/JavaRendererUtils/src/main/resources/FONTS/UnitFont.ttf -------------------------------------------------------------------------------- /core/JavaRendererUtils/src/main/resources/XML/index layout.txt: -------------------------------------------------------------------------------- 1 | Force Elements 2 | 3 | 770-799: small fills, inside the frame 4 | 5 | 800-900: regular fills with solid & dashed frame 6 | 7 | 1000 - 3000?: Warfighting - A - 8 | 9 | 3000 - 3200?: SigInt - D - 80 only need fill/frame/symbol 10 | 11 | 12 | 3200? - 3400?: Stability Operations Symbology - E - 60 w/ 6 that need 4 symbols & 6 with secondary symbol / fill 13 | 14 | 4000+: Emergency Management Symbols - G - 15 | ________________________________________________________________________________ 16 | Tactical Graphic Single Points 17 | 18 | 1900-1990: symbol fills 19 | 20 | 1999-2999: single point present 21 | 22 | 3000-3999: single point planned anticipated. 23 | 24 | 4000-4499: 2525Bch2 single point present 25 | 26 | 4500-4999: 2525Bch2 single point planned anticipated 27 | 28 | 5000: METOC single point 29 | 30 | 6000: EMS Natural Events 31 | ________________________________________________________________________________ 32 | 33 | 2525C vs 13-14 versions specifics 34 | Suppress 35 | Entry Control Point 36 | 37 | 52 | 53 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /core/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | io.github.missioncommand 6 | mil-sym-java 7 | 0.1.43 8 | .. 9 | 10 | 11 | mil-sym-java-core-parent 12 | pom 13 | mil-sym-java :: Core 14 | mil-sym-java Core 15 | 16 | 17 | JavaRendererUtils 18 | JavaLineArray 19 | JavaRendererServer 20 | JavaRenderer 21 | 22 | 23 | -------------------------------------------------------------------------------- /documentation/JavaRendererUtils apidocs.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/documentation/JavaRendererUtils apidocs.zip -------------------------------------------------------------------------------- /documentation/Mil Symbology Web Service Developer's Guide.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/documentation/Mil Symbology Web Service Developer's Guide.docx -------------------------------------------------------------------------------- /documentation/mil-sym-renderer apidocs.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/documentation/mil-sym-renderer apidocs.zip -------------------------------------------------------------------------------- /renderer/RendererPluginInterface/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | io.github.missioncommand 6 | mil-sym-java 7 | 0.1.43 8 | ../.. 9 | 10 | 11 | RendererPluginInterface 12 | jar 13 | mil-sym-java :: Renderer :: RendererPluginInterface 14 | 15 | 16 | 17 | junit 18 | junit 19 | test 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /renderer/RendererPluginInterface/src/main/java/ArmyC2/C2SD/RendererPluginInterface/ISinglePointInfo.java: -------------------------------------------------------------------------------- 1 | package ArmyC2.C2SD.RendererPluginInterface; 2 | 3 | import java.awt.geom.Point2D; 4 | import java.awt.geom.Rectangle2D; 5 | import java.awt.image.BufferedImage; 6 | 7 | /** 8 | * 9 | * @author michael.spinelli 10 | */ 11 | public interface ISinglePointInfo { 12 | 13 | /** 14 | * The BufferedImage 15 | * 16 | * @return the actual image 17 | */ 18 | public BufferedImage getImage(); 19 | 20 | /** 21 | * Anchor point of the symbol within the image. Typically the center 22 | * but not always. 23 | * 24 | * @return 25 | */ 26 | public Point2D getSymbolCenterPoint(); 27 | 28 | /** 29 | * minimum bounding rectangle for the core symbol. Does not include labels 30 | * surrounding the symbol. 31 | * 32 | * @return 33 | */ 34 | public Rectangle2D getSymbolBounds(); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /renderer/RendererPluginInterface/src/main/java/ArmyC2/C2SD/RendererPluginInterface/ISinglePointRenderer.java: -------------------------------------------------------------------------------- 1 | package ArmyC2.C2SD.RendererPluginInterface; 2 | 3 | import java.util.Map; 4 | 5 | /** 6 | * 7 | * @author michael.spinelli 8 | */ 9 | public interface ISinglePointRenderer { 10 | 11 | /** 12 | * Returns the unique ID of the renderer. This is used to identify which 13 | * renderer is to be used by the renderer service for a given render call. 14 | * 15 | * @return 16 | */ 17 | String getRendererID(); 18 | 19 | /** 20 | * Determines if the renderer can draw the symbol given the provided info. 21 | * 22 | * @param symbolID 23 | * @param params 24 | * @return 25 | */ 26 | Boolean canRender(String symbolID, Map params); 27 | 28 | /** 29 | * Attempts to render the symbol given the provided info. 30 | * 31 | * @param symbolID 32 | * @param params 33 | * @return 34 | */ 35 | ISinglePointInfo render(String symbolID, Map params); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /renderer/RendererPluginInterface/src/main/java/ArmyC2/C2SD/RendererPluginInterface/SinglePointInfo.java: -------------------------------------------------------------------------------- 1 | package ArmyC2.C2SD.RendererPluginInterface; 2 | 3 | import java.awt.geom.Point2D; 4 | import java.awt.geom.Rectangle2D; 5 | import java.awt.image.BufferedImage; 6 | 7 | /** 8 | * 9 | * @author michael.spinelli 10 | */ 11 | public class SinglePointInfo implements ISinglePointInfo { 12 | 13 | private BufferedImage _Image = null; 14 | private Point2D _centerPoint = null; 15 | Rectangle2D _symbolBounds = null; 16 | 17 | public SinglePointInfo(BufferedImage bi) { 18 | _Image = bi; 19 | _centerPoint = new Point2D.Double(bi.getWidth() / 2, bi.getHeight() / 2); 20 | _symbolBounds = new Rectangle2D.Double(0, 0, bi.getWidth(), bi.getHeight()); 21 | } 22 | 23 | public SinglePointInfo(BufferedImage bi, Point2D centerPoint, Rectangle2D symbolBounds) { 24 | _Image = bi; 25 | _centerPoint = centerPoint; 26 | _symbolBounds = symbolBounds; 27 | } 28 | 29 | @Override 30 | public BufferedImage getImage() { 31 | return _Image; 32 | } 33 | 34 | @Override 35 | public Rectangle2D getSymbolBounds() { 36 | return _symbolBounds; 37 | } 38 | 39 | @Override 40 | public Point2D getSymbolCenterPoint() { 41 | return _centerPoint; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/org/gavaghan/geodesy/Angle.java: -------------------------------------------------------------------------------- 1 | /* Geodesy by Mike Gavaghan 2 | * 3 | * http://www.gavaghan.org/blog/free-source-code/geodesy-library-vincentys-formula/ 4 | * 5 | * This code may be freely used and modified on any personal or professional 6 | * project. It comes with no warranty. 7 | */ 8 | package org.gavaghan.geodesy; 9 | 10 | /** 11 | * Utility methods for dealing with angles. 12 | * 13 | * @author Mike Gavaghan 14 | */ 15 | public class Angle 16 | { 17 | /** Degrees/Radians conversion constant. */ 18 | static private final double PiOver180 = Math.PI / 180.0; 19 | 20 | /** 21 | * Disallow instantiation. 22 | */ 23 | private Angle() 24 | { 25 | } 26 | 27 | /** 28 | * Convert degrees to radians. 29 | * @param degrees 30 | * @return 31 | */ 32 | static public double toRadians( double degrees ) 33 | { 34 | return degrees * PiOver180; 35 | } 36 | 37 | /** 38 | * Convert radians to degrees. 39 | * @param radians 40 | * @return 41 | */ 42 | static public double toDegrees( double radians ) 43 | { 44 | return radians / PiOver180; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/org/gavaghan/geodesy/Ellipsoid.java: -------------------------------------------------------------------------------- 1 | /* Geodesy by Mike Gavaghan 2 | * 3 | * http://www.gavaghan.org/blog/free-source-code/geodesy-library-vincentys-formula/ 4 | * 5 | * This code may be freely used and modified on any personal or professional 6 | * project. It comes with no warranty. 7 | */ 8 | package org.gavaghan.geodesy; 9 | 10 | import java.io.Serializable; 11 | 12 | /** 13 | * Encapsulation of an ellipsoid, and declaration of common reference 14 | * ellipsoids. 15 | * 16 | * @author Mike Gavaghan 17 | */ 18 | public class Ellipsoid implements Serializable { 19 | private static final long serialVersionUID = -2694307956656400089L; 20 | 21 | /** Semi major axis (meters). */ 22 | private final double mSemiMajorAxis; 23 | 24 | /** Semi minor axis (meters). */ 25 | private final double mSemiMinorAxis; 26 | 27 | /** Flattening. */ 28 | private final double mFlattening; 29 | 30 | /** Inverse flattening. */ 31 | private final double mInverseFlattening; 32 | 33 | /** 34 | * Construct a new Ellipsoid. This is private to ensure the values are 35 | * consistent (flattening = 1.0 / inverseFlattening). Use the methods 36 | * fromAAndInverseF() and fromAAndF() to create new instances. 37 | * 38 | * @param semiMajor 39 | * @param semiMinor 40 | * @param flattening 41 | * @param inverseFlattening 42 | */ 43 | private Ellipsoid(double semiMajor, double semiMinor, double flattening, double inverseFlattening) { 44 | mSemiMajorAxis = semiMajor; 45 | mSemiMinorAxis = semiMinor; 46 | mFlattening = flattening; 47 | mInverseFlattening = inverseFlattening; 48 | } 49 | 50 | /** The WGS84 ellipsoid. */ 51 | static public final Ellipsoid WGS84 = fromAAndInverseF(6378137.0, 298.257223563); 52 | 53 | /** The GRS80 ellipsoid. */ 54 | static public final Ellipsoid GRS80 = fromAAndInverseF(6378137.0, 298.257222101); 55 | 56 | /** The GRS67 ellipsoid. */ 57 | static public final Ellipsoid GRS67 = fromAAndInverseF(6378160.0, 298.25); 58 | 59 | /** The ANS ellipsoid. */ 60 | static public final Ellipsoid ANS = fromAAndInverseF(6378160.0, 298.25); 61 | 62 | /** The WGS72 ellipsoid. */ 63 | static public final Ellipsoid WGS72 = fromAAndInverseF(6378135.0, 298.26); 64 | 65 | /** The Clarke1858 ellipsoid. */ 66 | static public final Ellipsoid Clarke1858 = fromAAndInverseF(6378293.645, 294.26); 67 | 68 | /** The Clarke1880 ellipsoid. */ 69 | static public final Ellipsoid Clarke1880 = fromAAndInverseF(6378249.145, 293.465); 70 | 71 | /** A spherical "ellipsoid". */ 72 | static public final Ellipsoid Sphere = fromAAndF(6371000, 0.0); 73 | 74 | /** 75 | * Build an Ellipsoid from the semi major axis measurement and the inverse 76 | * flattening. 77 | * 78 | * @param semiMajor 79 | * semi major axis (meters) 80 | * @param inverseFlattening 81 | * @return 82 | */ 83 | static public Ellipsoid fromAAndInverseF(double semiMajor, double inverseFlattening) { 84 | double f = 1.0 / inverseFlattening; 85 | double b = (1.0 - f) * semiMajor; 86 | 87 | return new Ellipsoid(semiMajor, b, f, inverseFlattening); 88 | } 89 | 90 | /** 91 | * Build an Ellipsoid from the semi major axis measurement and the 92 | * flattening. 93 | * 94 | * @param semiMajor 95 | * semi major axis (meters) 96 | * @param flattening 97 | * @return 98 | */ 99 | static public Ellipsoid fromAAndF(double semiMajor, double flattening) { 100 | double inverseF = 1.0 / flattening; 101 | double b = (1.0 - flattening) * semiMajor; 102 | 103 | return new Ellipsoid(semiMajor, b, flattening, inverseF); 104 | } 105 | 106 | /** 107 | * Get semi-major axis. 108 | * 109 | * @return semi-major axis (in meters). 110 | */ 111 | public double getSemiMajorAxis() { 112 | return mSemiMajorAxis; 113 | } 114 | 115 | /** 116 | * Get semi-minor axis. 117 | * 118 | * @return semi-minor axis (in meters). 119 | */ 120 | public double getSemiMinorAxis() { 121 | return mSemiMinorAxis; 122 | } 123 | 124 | /** 125 | * Get flattening 126 | * 127 | * @return 128 | */ 129 | public double getFlattening() { 130 | return mFlattening; 131 | } 132 | 133 | /** 134 | * Get inverse flattening. 135 | * 136 | * @return 137 | */ 138 | public double getInverseFlattening() { 139 | return mInverseFlattening; 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/org/gavaghan/geodesy/GeodeticCurve.java: -------------------------------------------------------------------------------- 1 | /* Geodesy by Mike Gavaghan 2 | * 3 | * http://www.gavaghan.org/blog/free-source-code/geodesy-library-vincentys-formula/ 4 | * 5 | * This code may be freely used and modified on any personal or professional 6 | * project. It comes with no warranty. 7 | */ 8 | package org.gavaghan.geodesy; 9 | 10 | import java.io.Serializable; 11 | 12 | /** 13 | * This is the outcome of a geodetic calculation. It represents the path and 14 | * ellipsoidal distance between two GlobalCoordinates for a specified reference 15 | * ellipsoid. 16 | * 17 | * @author Mike Gavaghan 18 | */ 19 | public class GeodeticCurve implements Serializable 20 | { 21 | /** Ellipsoidal distance (in meters). */ 22 | private final double mEllipsoidalDistance; 23 | 24 | /** Azimuth (degrees from north). */ 25 | private final double mAzimuth; 26 | 27 | /** Reverse azimuth (degrees from north). */ 28 | private final double mReverseAzimuth; 29 | 30 | /** 31 | * Create a new GeodeticCurve. 32 | * @param ellipsoidalDistance ellipsoidal distance in meters 33 | * @param azimuth azimuth in degrees 34 | * @param reverseAzimuth reverse azimuth in degrees 35 | */ 36 | public GeodeticCurve(double ellipsoidalDistance, double azimuth, double reverseAzimuth) 37 | { 38 | mEllipsoidalDistance = ellipsoidalDistance; 39 | mAzimuth = azimuth; 40 | mReverseAzimuth = reverseAzimuth; 41 | } 42 | 43 | /** 44 | * Get the ellipsoidal distance. 45 | * @return ellipsoidal distance in meters 46 | */ 47 | public double getEllipsoidalDistance() 48 | { 49 | return mEllipsoidalDistance; 50 | } 51 | 52 | /** 53 | * Get the azimuth. 54 | * @return azimuth in degrees 55 | */ 56 | public double getAzimuth() 57 | { 58 | return mAzimuth; 59 | } 60 | 61 | /** 62 | * Get the reverse azimuth. 63 | * @return reverse azimuth in degrees 64 | */ 65 | public double getReverseAzimuth() 66 | { 67 | return mReverseAzimuth; 68 | } 69 | 70 | /** 71 | * Get curve as a string. 72 | * @return 73 | */ 74 | @Override 75 | public String toString() 76 | { 77 | StringBuffer buffer = new StringBuffer(); 78 | 79 | buffer.append("s="); 80 | buffer.append(mEllipsoidalDistance); 81 | buffer.append(";a12="); 82 | buffer.append(mAzimuth); 83 | buffer.append(";a21="); 84 | buffer.append(mReverseAzimuth); 85 | buffer.append(";"); 86 | 87 | return buffer.toString(); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/org/gavaghan/geodesy/GeodeticMeasurement.java: -------------------------------------------------------------------------------- 1 | /* Geodesy by Mike Gavaghan 2 | * 3 | * http://www.gavaghan.org/blog/free-source-code/geodesy-library-vincentys-formula/ 4 | * 5 | * This code may be freely used and modified on any personal or professional 6 | * project. It comes with no warranty. 7 | */ 8 | package org.gavaghan.geodesy; 9 | 10 | /** 11 | * This is the outcome of a three dimensional geodetic calculation. It 12 | * represents the path a between two GlobalPositions for a specified reference 13 | * ellipsoid. 14 | * 15 | * @author Mike Gavaghan 16 | */ 17 | public class GeodeticMeasurement extends GeodeticCurve 18 | { 19 | /** 20 | * The elevation change, in meters, going from the starting to the ending 21 | * point. 22 | */ 23 | private final double mElevationChange; 24 | 25 | /** The distance travelled, in meters, going from one point to the next. */ 26 | private final double mP2P; 27 | 28 | /** 29 | * Creates a new instance of GeodeticMeasurement. 30 | * 31 | * @param ellipsoidalDistance ellipsoidal distance in meters 32 | * @param azimuth azimuth in degrees 33 | * @param reverseAzimuth reverse azimuth in degrees 34 | * @param elevationChange the change in elevation, in meters, going from the 35 | * starting point to the ending point 36 | */ 37 | public GeodeticMeasurement(double ellipsoidalDistance, double azimuth, double reverseAzimuth, double elevationChange) 38 | { 39 | super(ellipsoidalDistance, azimuth, reverseAzimuth); 40 | mElevationChange = elevationChange; 41 | mP2P = Math.sqrt(ellipsoidalDistance * ellipsoidalDistance + mElevationChange * mElevationChange); 42 | } 43 | 44 | /** 45 | * Creates a new instance of GeodeticMeasurement. 46 | * 47 | * @param averageCurve average geodetic curve 48 | * @param elevationChange the change in elevation, in meters, going from the 49 | * starting point to the ending point 50 | */ 51 | public GeodeticMeasurement(GeodeticCurve averageCurve, double elevationChange) 52 | { 53 | this(averageCurve.getEllipsoidalDistance(), averageCurve.getAzimuth(), averageCurve.getReverseAzimuth(), elevationChange); 54 | } 55 | 56 | /** 57 | * Get the elevation change. 58 | * 59 | * @return elevation change, in meters, going from the starting to the ending 60 | * point 61 | */ 62 | public double getElevationChange() 63 | { 64 | return mElevationChange; 65 | } 66 | 67 | /** 68 | * Get the point-to-point distance. 69 | * 70 | * @return the distance travelled, in meters, going from one point to the 71 | * next 72 | */ 73 | public double getPointToPointDistance() 74 | { 75 | return mP2P; 76 | } 77 | 78 | /** 79 | * Get the GeodeticMeasurement as a string. 80 | */ 81 | @Override 82 | public String toString() 83 | { 84 | StringBuffer buffer = new StringBuffer(); 85 | 86 | buffer.append(super.toString()); 87 | buffer.append("elev12="); 88 | buffer.append(mElevationChange); 89 | buffer.append(";p2p="); 90 | buffer.append(mP2P); 91 | 92 | return buffer.toString(); 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/org/gavaghan/geodesy/GlobalPosition.java: -------------------------------------------------------------------------------- 1 | /* Geodesy by Mike Gavaghan 2 | * 3 | * http://www.gavaghan.org/blog/free-source-code/geodesy-library-vincentys-formula/ 4 | * 5 | * This code may be freely used and modified on any personal or professional 6 | * project. It comes with no warranty. 7 | */ 8 | package org.gavaghan.geodesy; 9 | 10 | /** 11 | *

12 | * Encapsulates a three dimensional location on a globe (GlobalCoordinates 13 | * combined with an elevation in meters above a reference ellipsoid). 14 | *

15 | *

16 | * See documentation for GlobalCoordinates for details on how latitude and 17 | * longitude measurements are canonicalized. 18 | *

19 | * 20 | * @author Mike Gavaghan 21 | */ 22 | public class GlobalPosition extends GlobalCoordinates 23 | { 24 | /** Elevation, in meters, above the surface of the ellipsoid. */ 25 | private double mElevation; 26 | 27 | /** 28 | * Creates a new instance of GlobalPosition. 29 | * 30 | * @param latitude latitude in degrees 31 | * @param longitude longitude in degrees 32 | * @param elevation elevation, in meters, above the reference ellipsoid 33 | */ 34 | public GlobalPosition(double latitude, double longitude, double elevation) 35 | { 36 | super(latitude, longitude); 37 | mElevation = elevation; 38 | } 39 | 40 | /** 41 | * Creates a new instance of GlobalPosition. 42 | * 43 | * @param coords coordinates of the position 44 | * @param elevation elevation, in meters, above the reference ellipsoid 45 | */ 46 | public GlobalPosition(GlobalCoordinates coords, double elevation) 47 | { 48 | this(coords.getLatitude(), coords.getLongitude(), elevation); 49 | } 50 | 51 | /** 52 | * Get elevation. 53 | * 54 | * @return elevation about the ellipsoid in meters. 55 | */ 56 | public double getElevation() 57 | { 58 | return mElevation; 59 | } 60 | 61 | /** 62 | * Set the elevation. 63 | * 64 | * @param elevation elevation about the ellipsoid in meters. 65 | */ 66 | public void setElevation(double elevation) 67 | { 68 | mElevation = elevation; 69 | } 70 | 71 | /** 72 | * Compare this position to another. Western longitudes are less than eastern 73 | * logitudes. If longitudes are equal, then southern latitudes are less than 74 | * northern latitudes. If coordinates are equal, lower elevations are less 75 | * than higher elevations 76 | * 77 | * @param other instance to compare to 78 | * @return -1, 0, or +1 as per Comparable contract 79 | */ 80 | public int compareTo(GlobalPosition other) 81 | { 82 | int retval = super.compareTo(other); 83 | 84 | if (retval == 0) 85 | { 86 | if (mElevation < other.mElevation) retval = -1; 87 | else if (mElevation > other.mElevation) retval = +1; 88 | } 89 | 90 | return retval; 91 | } 92 | 93 | /** 94 | * Get a hash code for this position. 95 | * 96 | * @return 97 | */ 98 | @Override 99 | public int hashCode() 100 | { 101 | int hash = super.hashCode(); 102 | 103 | if (mElevation != 0) hash *= (int) mElevation; 104 | 105 | return hash; 106 | } 107 | 108 | /** 109 | * Compare this position to another object for equality. 110 | * 111 | * @param other 112 | * @return 113 | */ 114 | @Override 115 | public boolean equals(Object obj) 116 | { 117 | if (!(obj instanceof GlobalPosition)) return false; 118 | 119 | GlobalPosition other = (GlobalPosition) obj; 120 | 121 | return (mElevation == other.mElevation) && (super.equals(other)); 122 | } 123 | 124 | /** 125 | * Get position as a string. 126 | */ 127 | @Override 128 | public String toString() 129 | { 130 | StringBuffer buffer = new StringBuffer(); 131 | 132 | buffer.append(super.toString()); 133 | buffer.append("elevation="); 134 | buffer.append(Double.toString(mElevation)); 135 | buffer.append("m"); 136 | 137 | return buffer.toString(); 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/geo/GeoArc.java: -------------------------------------------------------------------------------- 1 | package sec.geo; 2 | 3 | public class GeoArc extends GeoPath { 4 | public GeoArc(GeoPoint pivot, double widthMeters, double heightMeters, double leftAzimuth, double rightAzimuth, 5 | double maxDistanceMeters, double flatnessDistanceMeters, int limit) { 6 | super(maxDistanceMeters, flatnessDistanceMeters, limit); 7 | 8 | moveTo(pivot); 9 | arcTo(pivot, widthMeters, heightMeters, leftAzimuth, rightAzimuth); 10 | closePath(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/geo/GeoBlock.java: -------------------------------------------------------------------------------- 1 | package sec.geo; 2 | 3 | import org.gavaghan.geodesy.GeodeticCurve; 4 | import org.gavaghan.geodesy.GlobalCoordinates; 5 | 6 | public class GeoBlock extends GeoPath { 7 | public GeoBlock(GeoPoint p1, GeoPoint p2, double widthMeters, double maxDistanceMeters, 8 | double flatnessDistanceMeters, int limit) { 9 | super(maxDistanceMeters, flatnessDistanceMeters, limit); 10 | 11 | GlobalCoordinates c1 = toGlobalCoord(p1); 12 | GlobalCoordinates c2 = toGlobalCoord(p2); 13 | GeodeticCurve curve = geoCalc.calculateGeodeticCurve(REFERENCE_ELLIPSOID, c1, c2); 14 | double a1 = curve.getAzimuth(); 15 | double a2 = curve.getReverseAzimuth(); 16 | double radius = widthMeters / 2; 17 | 18 | GlobalCoordinates c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, c1, a1 - 90, radius); 19 | moveTo(c.getLongitude(), c.getLatitude()); 20 | c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, c2, a2 + 90, radius); 21 | lineTo(c.getLongitude(), c.getLatitude()); 22 | c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, c2, a2 - 90, radius); 23 | lineTo(c.getLongitude(), c.getLatitude()); 24 | c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, c1, a1 + 90, radius); 25 | lineTo(c.getLongitude(), c.getLatitude()); 26 | closePath(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/geo/GeoBlock2.java: -------------------------------------------------------------------------------- 1 | package sec.geo; 2 | 3 | import org.gavaghan.geodesy.GeodeticCurve; 4 | import org.gavaghan.geodesy.GlobalCoordinates; 5 | import static sec.geo.GeoPath.REFERENCE_ELLIPSOID; 6 | 7 | public class GeoBlock2 extends GeoPath { 8 | public GeoBlock2(GeoPoint p1, GeoPoint p2, double leftWidthMeters, double rightWidthMeters, double maxDistanceMeters, 9 | double flatnessDistanceMeters, int limit) { 10 | super(maxDistanceMeters, flatnessDistanceMeters, limit); 11 | 12 | GlobalCoordinates c1 = toGlobalCoord(p1); 13 | GlobalCoordinates c2 = toGlobalCoord(p2); 14 | GeodeticCurve curve = geoCalc.calculateGeodeticCurve(REFERENCE_ELLIPSOID, c1, c2); 15 | double a1 = curve.getAzimuth(); 16 | double a2 = curve.getReverseAzimuth(); 17 | double leftRadius = leftWidthMeters; 18 | double rightRadius = rightWidthMeters; 19 | 20 | GlobalCoordinates c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, c1, a1 - 90, leftRadius); 21 | moveTo(c.getLongitude(), c.getLatitude()); 22 | c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, c2, a2 + 90, leftRadius); 23 | lineTo(c.getLongitude(), c.getLatitude()); 24 | c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, c2, a2 - 90, rightRadius); 25 | lineTo(c.getLongitude(), c.getLatitude()); 26 | c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, c1, a1 + 90, rightRadius); 27 | lineTo(c.getLongitude(), c.getLatitude()); 28 | closePath(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/geo/GeoEllipse.java: -------------------------------------------------------------------------------- 1 | package sec.geo; 2 | 3 | public class GeoEllipse extends GeoPath { 4 | public GeoEllipse(GeoPoint pivot, double widthMeters, double heightMeters, double maxDistanceMeters, 5 | double flatnessDistanceMeters, int limit) { 6 | super(maxDistanceMeters, flatnessDistanceMeters, limit); 7 | arcTo(pivot, widthMeters, heightMeters, 0, 180); 8 | arcTo(pivot, widthMeters, heightMeters, 180, 0); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/geo/GeoPoint.java: -------------------------------------------------------------------------------- 1 | package sec.geo; 2 | 3 | import java.awt.geom.Point2D; 4 | 5 | public class GeoPoint extends Point2D.Double { 6 | private static final long serialVersionUID = -1693809094948881246L; 7 | 8 | public GeoPoint() { 9 | super(); 10 | } 11 | 12 | public GeoPoint(double longitudeDegrees, double latitudeDegrees) { 13 | super(longitudeDegrees, latitudeDegrees); 14 | } 15 | 16 | public double getLatitude() { 17 | return y; 18 | } 19 | 20 | public void setLatitude(double latitudeDegrees) { 21 | y = latitudeDegrees; 22 | } 23 | 24 | public double getLongitude() { 25 | return x; 26 | } 27 | 28 | public void setLongitude(double longitudeDegrees) { 29 | x = longitudeDegrees; 30 | } 31 | 32 | @Override 33 | public String toString() { 34 | return x + "," + y; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/geo/kml/KmlOptions.java: -------------------------------------------------------------------------------- 1 | package sec.geo.kml; 2 | 3 | public class KmlOptions { 4 | 5 | 6 | public enum AltitudeMode { 7 | ABSOLUTE ("absolute"), 8 | RELATIVE_TO_GROUND ("relativeToGround"), 9 | RELATIVE_TO_SEA_FLOOR ("relativeToSeaFloor"), 10 | CLAMP_TO_GROUND ("clampToGround"), 11 | CLAMP_TO_SEA_FLOOR("clampToSeaFloor"); 12 | 13 | private String mode = "absolute"; 14 | 15 | private AltitudeMode(String mode) { 16 | this.mode = mode; 17 | } 18 | 19 | public static AltitudeMode fromString(String mode) { 20 | if(mode != null) { 21 | for(AltitudeMode am : AltitudeMode.values()) { 22 | if(am.getMode().equals(mode)) { 23 | return am; 24 | } 25 | } 26 | } 27 | throw new IllegalArgumentException("No AltitudeMode with mode \""+mode+"\" found"); 28 | } 29 | 30 | public String toString(){ 31 | return this.mode; 32 | } 33 | 34 | public String getMode() { 35 | return mode; 36 | } 37 | } 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/geo/kml/KmlPolygon.java: -------------------------------------------------------------------------------- 1 | package sec.geo.kml; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collections; 5 | import java.util.List; 6 | 7 | import org.gavaghan.geodesy.Ellipsoid; 8 | import org.gavaghan.geodesy.GeodeticCalculator; 9 | import org.gavaghan.geodesy.GlobalCoordinates; 10 | import org.gavaghan.geodesy.GlobalPosition; 11 | 12 | import sec.geo.GeoPoint; 13 | import sec.geo.kml.KmlOptions.AltitudeMode; 14 | import sec.geo.shape.Point; 15 | 16 | public class KmlPolygon { 17 | //private static final String PREFIX = "relativeToGround"; 18 | //private static final String SUFFIX = ""; 19 | private final List points; 20 | 21 | private AltitudeMode altitudeMode = AltitudeMode.ABSOLUTE; 22 | 23 | 24 | //protected final GeodeticCalculator geoCalc; 25 | protected static final Ellipsoid REFERENCE_ELLIPSOID = Ellipsoid.WGS84; 26 | private String altitudeModeField = "#ALTITUDEMODE#"; 27 | 28 | private String PREFIX = "" + 29 | " \n" + 30 | " 1\n" + 31 | " "+altitudeModeField+"\n" + 32 | " "; 33 | private String SUFFIX = "" + 34 | " \n" + 35 | " \n"; 36 | 37 | 38 | 39 | public KmlPolygon() { 40 | points = new ArrayList(); 41 | } 42 | 43 | public KmlPolygon(List points, AltitudeMode altitudeMode) { 44 | this(); 45 | this.points.addAll(points); 46 | this.altitudeMode = altitudeMode; 47 | } 48 | 49 | 50 | public void addPoint(Point point) { 51 | points.add(point); 52 | } 53 | 54 | public void addPoints(List points) { 55 | this.points.addAll(points); 56 | } 57 | 58 | @Override 59 | public String toString() { 60 | StringBuilder sb = new StringBuilder(); 61 | 62 | 63 | 64 | sb.append(PREFIX); 65 | sb.append(toCoordString()); 66 | sb.append(SUFFIX); 67 | 68 | int altitudeModeIndex = sb.indexOf(altitudeModeField); 69 | int altitudeModeLength = altitudeModeField.length(); 70 | if(altitudeMode != null) 71 | sb.replace(altitudeModeIndex, altitudeModeIndex + altitudeModeLength, altitudeMode.toString()); 72 | 73 | return sb.toString(); 74 | } 75 | 76 | public String toCoordString() { 77 | StringBuilder sb = new StringBuilder(); 78 | 79 | List orderedPoints = getPointsCounterClockwise(); 80 | if(orderedPoints == null) 81 | return ""; 82 | 83 | for (Point point : orderedPoints) { 84 | sb.append(point.getLongitude()); 85 | sb.append(","); 86 | sb.append(point.getLatitude()); 87 | sb.append(","); 88 | sb.append(point.getAltitude()); 89 | sb.append(" "); 90 | } 91 | 92 | // Close off the list of coordinates if necessary 93 | Point point = orderedPoints.get(0); 94 | if (!point.equals(orderedPoints.get(orderedPoints.size() - 1))) { 95 | sb.append(point.getLongitude()); 96 | sb.append(","); 97 | sb.append(point.getLatitude()); 98 | sb.append(","); 99 | sb.append(point.getAltitude()); 100 | sb.append(" "); 101 | } 102 | 103 | return sb.toString(); 104 | } 105 | 106 | 107 | public AltitudeMode getAltitudeMode() { 108 | return altitudeMode; 109 | } 110 | 111 | public void setAltitudeMode(AltitudeMode altitudeMode) { 112 | this.altitudeMode = altitudeMode; 113 | } 114 | 115 | public List getPointsClockwise() { 116 | if(points == null || points.size() < 3) 117 | return null; 118 | 119 | List result = points.subList(0, points.size()-1); 120 | int order = getPointOrder(); 121 | if(order < 0) { 122 | Collections.reverse(result); 123 | return result; 124 | } 125 | else return result; 126 | } 127 | 128 | public List getPointsCounterClockwise() { 129 | if(points == null || points.size() < 3) 130 | return null; 131 | 132 | List result = points.subList(0, points.size()-1); 133 | int order = getPointOrder(); 134 | if(order > 0) { 135 | Collections.reverse(result); 136 | return result; 137 | } 138 | else return result; 139 | } 140 | 141 | public int getPointOrder() { 142 | if(points==null || points.size()<3) 143 | return 0; 144 | 145 | int n = points.size(); 146 | int j, k, count = 0; 147 | double z; 148 | for(int i=0; i 0) 156 | count++; 157 | } 158 | if(count > 0) 159 | return -1; //counterclockwise 160 | else if(count < 0) 161 | return 1; //clockwise 162 | else return 0; //invalid 163 | } 164 | } 165 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/geo/kml/KmlStyle.java: -------------------------------------------------------------------------------- 1 | package sec.geo.kml; 2 | 3 | public class KmlStyle { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/geo/shape/AArc.java: -------------------------------------------------------------------------------- 1 | package sec.geo.shape; 2 | 3 | public abstract class AArc extends APivot { 4 | protected double leftAzimuthDegrees, rightAzimuthDegrees; 5 | 6 | public void setRightAzimuthDegrees(double rightAzimuthDegrees) { 7 | this.rightAzimuthDegrees = rightAzimuthDegrees; 8 | shapeChanged(); 9 | } 10 | 11 | public void setLeftAzimuthDegrees(double leftAzimuthDegrees) { 12 | this.leftAzimuthDegrees = leftAzimuthDegrees; 13 | shapeChanged(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/geo/shape/AComposite.java: -------------------------------------------------------------------------------- 1 | package sec.geo.shape; 2 | 3 | import java.util.HashSet; 4 | import java.util.Set; 5 | 6 | public class AComposite { 7 | protected Set elements; 8 | 9 | public AComposite() { 10 | elements = new HashSet(); 11 | } 12 | 13 | public Set getElements() { 14 | return elements; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/geo/shape/AExtrusion.java: -------------------------------------------------------------------------------- 1 | package sec.geo.shape; 2 | 3 | import java.awt.Shape; 4 | 5 | import sec.geo.kml.KmlOptions.AltitudeMode; 6 | 7 | public abstract class AExtrusion { 8 | private double minAltitudeMeters; 9 | private double maxAltitudeMeters; 10 | private Shape shape; 11 | protected double maxDistanceMeters; 12 | protected double flatnessDistanceMeters; 13 | 14 | protected AltitudeMode altitudeMode; 15 | protected int limit; 16 | 17 | public AExtrusion() { 18 | maxDistanceMeters = 100000; 19 | flatnessDistanceMeters = 1; 20 | limit = 4; 21 | } 22 | 23 | public Shape getShape() { 24 | if (shape == null) { 25 | shape = createShape(); 26 | } 27 | return shape; 28 | } 29 | 30 | protected void shapeChanged() { 31 | shape = null; 32 | } 33 | 34 | protected abstract Shape createShape(); 35 | 36 | public double getMinAltitude() { 37 | return minAltitudeMeters; 38 | } 39 | 40 | public void setMinAltitude(double minAltitudeMeters) { 41 | this.minAltitudeMeters = minAltitudeMeters; 42 | shapeChanged(); 43 | } 44 | 45 | public double getMaxAltitude() { 46 | return maxAltitudeMeters; 47 | } 48 | 49 | public void setMaxAltitude(double maxAltitudeMeters) { 50 | this.maxAltitudeMeters = maxAltitudeMeters; 51 | shapeChanged(); 52 | } 53 | 54 | public void setMaxDistance(double maxDistanceMeters) { 55 | this.maxDistanceMeters = maxDistanceMeters; 56 | shapeChanged(); 57 | } 58 | 59 | public void setFlatness(double flatnessDistanceMeters) { 60 | this.flatnessDistanceMeters = flatnessDistanceMeters; 61 | shapeChanged(); 62 | } 63 | 64 | public void setLimit(int limit) { 65 | this.limit = limit; 66 | shapeChanged(); 67 | } 68 | 69 | public AltitudeMode getAltitudeMode() { 70 | return altitudeMode; 71 | } 72 | 73 | public void setAltitudeMode(AltitudeMode altitudeMode) { 74 | this.altitudeMode = altitudeMode; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/geo/shape/APath.java: -------------------------------------------------------------------------------- 1 | package sec.geo.shape; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import sec.geo.GeoPoint; 7 | 8 | public abstract class APath extends AExtrusion { 9 | protected final List points; 10 | 11 | public APath() { 12 | points = new ArrayList(); 13 | } 14 | 15 | public void addPoint(GeoPoint point) { 16 | points.add(point); 17 | shapeChanged(); 18 | } 19 | 20 | public void addPoints(List points) { 21 | this.points.addAll(points); 22 | shapeChanged(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/geo/shape/APivot.java: -------------------------------------------------------------------------------- 1 | package sec.geo.shape; 2 | 3 | import sec.geo.GeoPoint; 4 | 5 | public abstract class APivot extends AExtrusion implements ICircle { 6 | protected GeoPoint pivot; 7 | protected double radiusMeters; 8 | 9 | public APivot() { 10 | pivot = new GeoPoint(); 11 | } 12 | 13 | @Override 14 | public void setRadius(double radiusMeters) { 15 | this.radiusMeters = radiusMeters; 16 | shapeChanged(); 17 | } 18 | 19 | @Override 20 | public void setPivot(GeoPoint pivot) { 21 | this.pivot = pivot; 22 | shapeChanged(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/geo/shape/Cake.java: -------------------------------------------------------------------------------- 1 | package sec.geo.shape; 2 | 3 | import sec.geo.GeoPoint; 4 | 5 | public class Cake extends AComposite implements IPivot { 6 | private GeoPoint pivot; 7 | 8 | public Cake() { 9 | super(); 10 | pivot = new GeoPoint(); 11 | } 12 | 13 | public void addLayer(AExtrusion layer) { 14 | if (layer instanceof IPivot) { 15 | ((IPivot) layer).setPivot(pivot); 16 | elements.add(layer); 17 | } else { 18 | throw new IllegalArgumentException(); 19 | } 20 | } 21 | 22 | @Override 23 | public void setPivot(GeoPoint pivot) { 24 | this.pivot = pivot; 25 | for (AExtrusion layer : elements) { 26 | ((IPivot) layer).setPivot(pivot); 27 | layer.shapeChanged(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/geo/shape/Circle.java: -------------------------------------------------------------------------------- 1 | package sec.geo.shape; 2 | 3 | import java.awt.Shape; 4 | 5 | import sec.geo.GeoEllipse; 6 | 7 | public class Circle extends APivot { 8 | @Override 9 | protected Shape createShape() { 10 | GeoEllipse e = new GeoEllipse(pivot, radiusMeters * 2, radiusMeters * 2, maxDistanceMeters, 11 | flatnessDistanceMeters, limit); 12 | return e; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/geo/shape/IArc.java: -------------------------------------------------------------------------------- 1 | package sec.geo.shape; 2 | 3 | public interface IArc extends ICircle { 4 | public void setRightAzimuthDegrees(double rightAzimuthDegrees); 5 | 6 | public void setLeftAzimuthDegrees(double leftAzimuthDegrees); 7 | } 8 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/geo/shape/ICircle.java: -------------------------------------------------------------------------------- 1 | package sec.geo.shape; 2 | 3 | public interface ICircle extends IPivot { 4 | void setRadius(double radiusMeters); 5 | } 6 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/geo/shape/IPivot.java: -------------------------------------------------------------------------------- 1 | package sec.geo.shape; 2 | 3 | import sec.geo.GeoPoint; 4 | 5 | public interface IPivot { 6 | void setPivot(GeoPoint pivot); 7 | } 8 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/geo/shape/Line.java: -------------------------------------------------------------------------------- 1 | package sec.geo.shape; 2 | 3 | import java.awt.Shape; 4 | 5 | import sec.geo.GeoPath; 6 | 7 | public class Line extends APath { 8 | @Override 9 | protected Shape createShape() { 10 | GeoPath path = new GeoPath(maxDistanceMeters, flatnessDistanceMeters, limit); 11 | for (int i = 0; i < points.size(); i++) { 12 | if (i > 0) { 13 | path.lineTo(points.get(i)); 14 | } else { 15 | path.moveTo(points.get(i)); 16 | } 17 | } 18 | return path; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/geo/shape/Orbit.java: -------------------------------------------------------------------------------- 1 | package sec.geo.shape; 2 | 3 | import java.awt.Shape; 4 | import java.awt.geom.Area; 5 | 6 | import sec.geo.GeoBlock; 7 | import sec.geo.GeoEllipse; 8 | import sec.geo.GeoPoint; 9 | 10 | public class Orbit extends APath { 11 | private double widthMeters; 12 | 13 | public void setWidth(double widthMeters) { 14 | this.widthMeters = widthMeters; 15 | shapeChanged(); 16 | } 17 | 18 | @Override 19 | protected Shape createShape() { 20 | Area orbit = new Area(); 21 | GeoPoint previousPoint = null; 22 | for (GeoPoint point : points) { 23 | GeoEllipse ellipse = new GeoEllipse(point, widthMeters, widthMeters, maxDistanceMeters, 24 | flatnessDistanceMeters, limit); 25 | orbit.add(new Area(ellipse)); 26 | if (previousPoint != null) { 27 | // Draw rectangle connection 28 | GeoBlock block = new GeoBlock(previousPoint, point, widthMeters, maxDistanceMeters, 29 | flatnessDistanceMeters, limit); 30 | orbit.add(new Area(block)); 31 | } 32 | previousPoint = point; 33 | } 34 | return orbit; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/geo/shape/Point.java: -------------------------------------------------------------------------------- 1 | package sec.geo.shape; 2 | 3 | import org.gavaghan.geodesy.GlobalPosition; 4 | 5 | public class Point { 6 | private final double longitudeDegrees; 7 | private final double latitudeDegrees; 8 | private final double altitudeMeters; 9 | 10 | public Point(double longitudeDegrees, double latitudeDegrees) { 11 | this(longitudeDegrees, latitudeDegrees, 0); 12 | } 13 | 14 | public Point(double longitudeDegrees, double latitudeDegrees, double altitudeMeters) { 15 | this.longitudeDegrees = longitudeDegrees; 16 | this.latitudeDegrees = latitudeDegrees; 17 | this.altitudeMeters = altitudeMeters; 18 | } 19 | 20 | public double getLongitude() { 21 | return longitudeDegrees; 22 | } 23 | 24 | public double getLatitude() { 25 | return latitudeDegrees; 26 | } 27 | 28 | public double getAltitude() { 29 | return altitudeMeters; 30 | } 31 | 32 | public GlobalPosition toGlobalPos() { 33 | return new GlobalPosition(getLatitude(), getLongitude(), getAltitude()); 34 | } 35 | 36 | 37 | @Override 38 | public boolean equals(Object o) { 39 | if (!(o instanceof Point)) { 40 | return false; 41 | } 42 | Point other = (Point) o; 43 | return (longitudeDegrees == other.longitudeDegrees) && (latitudeDegrees == other.latitudeDegrees) 44 | && (altitudeMeters == other.altitudeMeters); 45 | } 46 | 47 | @Override 48 | public String toString() { 49 | return "[" + longitudeDegrees + "," + latitudeDegrees + "," + altitudeMeters + "]"; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/geo/shape/Polyarc.java: -------------------------------------------------------------------------------- 1 | package sec.geo.shape; 2 | 3 | import java.awt.Shape; 4 | 5 | import sec.geo.GeoPath; 6 | import sec.geo.GeoPoint; 7 | 8 | public class Polyarc extends APath implements IArc { 9 | private GeoPoint pivot; 10 | private double radiusMeters; 11 | private double leftAzimuthDegrees, rightAzimuthDegrees; 12 | 13 | @Override 14 | public void setRadius(double radiusMeters) { 15 | this.radiusMeters = radiusMeters; 16 | shapeChanged(); 17 | } 18 | 19 | @Override 20 | public void setPivot(GeoPoint pivot) { 21 | this.pivot = pivot; 22 | shapeChanged(); 23 | } 24 | 25 | public void setRightAzimuthDegrees(double rightAzimuthDegrees) { 26 | this.rightAzimuthDegrees = rightAzimuthDegrees; 27 | shapeChanged(); 28 | } 29 | 30 | public void setLeftAzimuthDegrees(double leftAzimuthDegrees) { 31 | this.leftAzimuthDegrees = leftAzimuthDegrees; 32 | shapeChanged(); 33 | } 34 | 35 | @Override 36 | protected Shape createShape() { 37 | GeoPath shape = new GeoPath(maxDistanceMeters, flatnessDistanceMeters, limit); 38 | for (int i = 0; i < points.size(); i++) { 39 | GeoPoint point = points.get(i); 40 | if (i == 0) { 41 | shape.moveTo(point); 42 | } else { 43 | shape.lineTo(point); 44 | } 45 | } 46 | shape.arcTo(pivot, radiusMeters * 2, radiusMeters * 2, leftAzimuthDegrees, rightAzimuthDegrees); 47 | shape.closePath(); 48 | return shape; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/geo/shape/Polygon.java: -------------------------------------------------------------------------------- 1 | package sec.geo.shape; 2 | 3 | import java.awt.Shape; 4 | 5 | import sec.geo.GeoPath; 6 | 7 | public class Polygon extends APath { 8 | @Override 9 | protected Shape createShape() { 10 | GeoPath path = new GeoPath(maxDistanceMeters, flatnessDistanceMeters, limit); 11 | for (int i = 0; i < points.size(); i++) { 12 | if (i > 0) { 13 | path.lineTo(points.get(i)); 14 | } else { 15 | path.moveTo(points.get(i)); 16 | } 17 | } 18 | path.closePath(); 19 | return path; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/geo/shape/Radarc.java: -------------------------------------------------------------------------------- 1 | package sec.geo.shape; 2 | 3 | import java.awt.Shape; 4 | import java.awt.geom.Area; 5 | 6 | import sec.geo.GeoArc; 7 | import sec.geo.GeoEllipse; 8 | 9 | public class Radarc extends AArc { 10 | private double minRadiusMeters; 11 | 12 | public void setMinRadius(double minRadiusMeters) { 13 | this.minRadiusMeters = minRadiusMeters; 14 | shapeChanged(); 15 | } 16 | 17 | @Override 18 | protected Shape createShape() { 19 | GeoArc arc = new GeoArc(pivot, radiusMeters * 2, radiusMeters * 2, leftAzimuthDegrees, rightAzimuthDegrees, 20 | maxDistanceMeters, flatnessDistanceMeters, limit); 21 | Area shape = new Area(arc); 22 | GeoEllipse ellipse = new GeoEllipse(pivot, minRadiusMeters * 2, minRadiusMeters * 2, maxDistanceMeters, 23 | flatnessDistanceMeters, limit); 24 | shape.subtract(new Area(ellipse)); 25 | return shape; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/geo/shape/Route.java: -------------------------------------------------------------------------------- 1 | package sec.geo.shape; 2 | 3 | import java.awt.Shape; 4 | import java.awt.geom.Area; 5 | import java.awt.geom.PathIterator; 6 | 7 | import sec.geo.GeoBlock; 8 | import sec.geo.GeoBlock2; 9 | import sec.geo.GeoEllipse; 10 | import sec.geo.GeoPoint; 11 | 12 | public class Route extends APath { 13 | private double leftWidthMeters; 14 | private double rightWidthMeters; 15 | 16 | 17 | public void setLeftWidth(double widthMeters) { 18 | this.leftWidthMeters = widthMeters; 19 | shapeChanged(); 20 | } 21 | 22 | public void setRightWidth(double widthMeters) { 23 | this.rightWidthMeters = widthMeters; 24 | shapeChanged(); 25 | } 26 | 27 | @Override 28 | protected Shape createShape() { 29 | Area route = new Area(); 30 | GeoPoint previousPoint = null; 31 | for (int i = 0; i < points.size(); i++) { 32 | 33 | GeoPoint point = points.get(i); 34 | 35 | /* 36 | if (i > 0 && i < points.size() - 1) { 37 | GeoEllipse ellipse = new GeoEllipse(point, widthMeters, widthMeters, maxDistanceMeters, 38 | flatnessDistanceMeters, limit); 39 | route.add(new Area(ellipse)); 40 | } 41 | * */ 42 | if (previousPoint != null) { 43 | 44 | // Skip if points are the same -- doesn't take into account height difference 45 | if(previousPoint.equals(point)) 46 | continue; 47 | 48 | // Draw rectangle connection 49 | GeoBlock2 block = new GeoBlock2(previousPoint, point, this.leftWidthMeters, this.rightWidthMeters, maxDistanceMeters, 50 | flatnessDistanceMeters, limit); 51 | Area area = new Area(block); 52 | route.add(area); 53 | 54 | } 55 | previousPoint = point; 56 | } 57 | return route; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/geo/shape/Track.java: -------------------------------------------------------------------------------- 1 | package sec.geo.shape; 2 | 3 | public class Track extends AComposite { 4 | public void addRoute(Route route) { 5 | elements.add(route); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/web/exceptions/InvalidNumberOfPointsException.java: -------------------------------------------------------------------------------- 1 | package sec.web.exceptions; 2 | 3 | /** 4 | * 5 | * @author stephen.pinizzotto 6 | */ 7 | public class InvalidNumberOfPointsException extends Exception { 8 | private static final long serialVersionUID = 2791008774716307095L; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/web/json/utilities/HTTPTokener.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | /* 4 | Copyright (c) 2002 JSON.org 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | The Software shall be used for Good, not Evil. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | SOFTWARE. 25 | */ 26 | 27 | package sec.web.json.utilities; 28 | 29 | /** 30 | * The HTTPTokener extends the JSONTokener to provide additional methods 31 | * for the parsing of HTTP headers. 32 | * @author JSON.org 33 | * @version 2010-12-24 34 | */ 35 | public class HTTPTokener extends JSONTokener { 36 | 37 | /** 38 | * Construct an HTTPTokener from a string. 39 | * @param string A source string. 40 | */ 41 | public HTTPTokener(String string) { 42 | super(string); 43 | } 44 | 45 | 46 | /** 47 | * Get the next token or string. This is used in parsing HTTP headers. 48 | * @throws JSONException 49 | * @return A String. 50 | */ 51 | public String nextToken() throws JSONException { 52 | char c; 53 | char q; 54 | StringBuffer sb = new StringBuffer(); 55 | do { 56 | c = next(); 57 | } while (Character.isWhitespace(c)); 58 | if (c == '"' || c == '\'') { 59 | q = c; 60 | for (;;) { 61 | c = next(); 62 | if (c < ' ') { 63 | throw syntaxError("Unterminated string."); 64 | } 65 | if (c == q) { 66 | return sb.toString(); 67 | } 68 | sb.append(c); 69 | } 70 | } 71 | for (;;) { 72 | if (c == 0 || Character.isWhitespace(c)) { 73 | return sb.toString(); 74 | } 75 | sb.append(c); 76 | c = next(); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/web/json/utilities/JSONException.java: -------------------------------------------------------------------------------- 1 | package sec.web.json.utilities; 2 | 3 | /** 4 | * The JSONException is thrown by the JSON.org classes when things are amiss. 5 | * @author JSON.org 6 | * @version 2010-12-24 7 | */ 8 | public class JSONException extends Exception { 9 | private static final long serialVersionUID = 0; 10 | private Throwable cause; 11 | 12 | /** 13 | * Constructs a JSONException with an explanatory message. 14 | * @param message Detail about the reason for the exception. 15 | */ 16 | public JSONException(String message) { 17 | super(message); 18 | } 19 | 20 | public JSONException(Throwable cause) { 21 | super(cause.getMessage()); 22 | this.cause = cause; 23 | } 24 | 25 | public Throwable getCause() { 26 | return this.cause; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/web/json/utilities/JSONString.java: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * The JSONString interface allows a toJSONString() 4 | * method so that a class can change the behavior of 5 | * JSONObject.toString(), JSONArray.toString(), 6 | * and JSONWriter.value(Object). The 7 | * toJSONString method will be used instead of the default behavior 8 | * of using the Object's toString() method and quoting the result. 9 | */ 10 | package sec.web.json.utilities; 11 | 12 | public interface JSONString { 13 | /** 14 | * The toJSONString method allows a class to produce its own JSON 15 | * serialization. 16 | * 17 | * @return A strictly syntactically correct JSON text. 18 | */ 19 | public String toJSONString(); 20 | } 21 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/web/renderer/GeoPixelConversion.java: -------------------------------------------------------------------------------- 1 | package sec.web.renderer; 2 | 3 | public class GeoPixelConversion { 4 | 5 | private static double inchPerMeter = 39.3700787; 6 | private static double pixelsPerInch = 96.0; 7 | private static double METERS_PER_DEG = 111319.49079327357264771338267056; 8 | 9 | public static double metersPerPixel(double scale) { 10 | double step1 = scale / pixelsPerInch; 11 | return step1 / inchPerMeter; 12 | } 13 | 14 | public static double lat2y(double latitude, double scale, double latOrigin, double metPerPix) { 15 | 16 | double latRem = -(latitude - latOrigin); 17 | double pixDis = (latRem * METERS_PER_DEG) / metPerPix; 18 | return pixDis; 19 | } 20 | 21 | public static double y2lat(double yPosition, double scale, double latOrigin, double metPerPix) { 22 | 23 | double latitude = latOrigin - ((yPosition * metPerPix) / METERS_PER_DEG); 24 | return latitude; 25 | } 26 | 27 | public static double long2x(double longitude, double scale, double longOrigin, double latitude, double metPerPix,boolean normalize) { 28 | 29 | double longRem = longitude-longOrigin; 30 | if(normalize) 31 | { 32 | if (longRem > 180) { 33 | longRem -= 360; 34 | } 35 | if (longRem < -180) { 36 | longRem += 360; 37 | } 38 | } 39 | double metersPerDeg = GetMetersPerDegAtLat(latitude); 40 | double pixDis = (longRem * metersPerDeg) / metPerPix; 41 | return pixDis; 42 | } 43 | 44 | public static double x2long(double xPosition, double scale, double longOrigin, double latitude, double metPerPix) { 45 | 46 | double metersPerDeg = GetMetersPerDegAtLat(latitude); 47 | double longitude = longOrigin + ((xPosition * metPerPix) / metersPerDeg); 48 | 49 | if (longitude < -180) { 50 | longitude += 360; 51 | } else if (longitude > 180) { 52 | longitude -= 360; 53 | } 54 | 55 | return longitude; 56 | } 57 | 58 | public static double Deg2Rad(double deg) { 59 | double conv_factor = (2.0 * Math.PI) / 360.0; 60 | return (deg * conv_factor); 61 | } 62 | 63 | public static double GetMetersPerDegAtLat(double lat) { 64 | // Convert latitude to radians 65 | lat = Deg2Rad(lat); 66 | // Set up "Constants" 67 | double p1 = 111412.84; // longitude calculation term 1 68 | 69 | double p2 = -93.5; // longitude calculation term 2 70 | 71 | double p3 = 0.118; // longitude calculation term 3 72 | 73 | // Calculate the length of a degree of longitude in meters at given 74 | // latitude 75 | double longlen = (p1 * Math.cos(lat)) + (p2 * Math.cos(3 * lat)) + (p3 * Math.cos(5 * lat)); 76 | 77 | return longlen; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/web/renderer/PointConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package sec.web.renderer; 7 | import ArmyC2.C2SD.Utilities.IPointConversion; 8 | //import sec.web.renderer.GeoPixelConversion; 9 | import java.awt.geom.Point2D; 10 | import java.awt.Point; 11 | /** 12 | * 13 | * @author Michael Deutch 14 | */ 15 | public class PointConverter implements IPointConversion 16 | { 17 | private double _controlLat=0; 18 | private double _controlLong=0; 19 | private double _scale=0; 20 | private double _metersPerPixel=0; 21 | private boolean _normalize=true; 22 | public void set_normalize(boolean value) 23 | { 24 | _normalize=value; 25 | } 26 | public PointConverter(double controlLong, double controlLat, double scale) 27 | { 28 | try 29 | { 30 | this._controlLat=controlLat; 31 | this._controlLong=controlLong; 32 | this._scale=scale; 33 | _metersPerPixel=GeoPixelConversion.metersPerPixel(scale); 34 | } 35 | catch(Error e) 36 | { 37 | throw e; 38 | } 39 | } 40 | /** 41 | * add constructor to handle when earth is flipped about it's X axis (South is on top) 42 | * @param left 43 | * @param right 44 | * @param top 45 | * @param bottom 46 | * @param scale 47 | */ 48 | public PointConverter(double left, double top, double right, double bottom, double scale) 49 | { 50 | try 51 | { 52 | this._controlLat=top; 53 | this._controlLong=left; 54 | this._scale=scale; 55 | _metersPerPixel=GeoPixelConversion.metersPerPixel(scale); 56 | if(top X_ALTITUDE_DEPTH = new ArrayList(); 29 | public String Y_LOCATION = ""; 30 | public ArrayList AM_DISTANCE = new ArrayList(); 31 | public ArrayList AN_AZIMUTH = new ArrayList(); 32 | public String FillColor = ""; 33 | public String LineColor = ""; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/web/renderer/utilities/LineInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package sec.web.renderer.utilities; 6 | 7 | import java.awt.Color; 8 | import java.awt.Stroke; 9 | import java.awt.geom.Point2D; 10 | import java.util.ArrayList; 11 | 12 | /** 13 | * 14 | * @author michael.spinelli 15 | */ 16 | public class LineInfo { 17 | 18 | private Color lineColor = null; 19 | private Color fillColor = null; 20 | private int lineWidth = 2; 21 | private Stroke stroke = null; 22 | 23 | private ArrayList> _Polylines = null; 24 | 25 | public LineInfo() 26 | { 27 | 28 | 29 | } 30 | 31 | public void setLineColor(Color value) 32 | { 33 | lineColor=value; 34 | } 35 | public Color getLineColor() 36 | { 37 | return lineColor; 38 | } 39 | 40 | public void setFillColor(Color value) 41 | { 42 | fillColor=value; 43 | } 44 | public Color getFillColor() 45 | { 46 | return fillColor; 47 | } 48 | 49 | public Stroke getStroke() 50 | { 51 | return stroke; 52 | } 53 | //client will use this to do fills (if it is not null) 54 | /* 55 | public TexturePaint getTexturePaint() 56 | { 57 | return texturePaint; 58 | } 59 | public void setTexturePaint(TexturePaint value) 60 | { 61 | texturePaint=value; 62 | }*/ 63 | 64 | public void setStroke(Stroke s) 65 | { 66 | stroke=s; 67 | } 68 | 69 | public ArrayList> getPolylines() 70 | { 71 | return _Polylines; 72 | } 73 | 74 | public void setPolylines(ArrayList> value) 75 | { 76 | _Polylines = value; 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/web/renderer/utilities/SymbolInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package sec.web.renderer.utilities; 6 | 7 | import java.util.ArrayList; 8 | 9 | /** 10 | * 11 | * @author michael.spinelli 12 | */ 13 | public class SymbolInfo { 14 | 15 | private ArrayList _LineInfo = null; 16 | private ArrayList _TextInfo = null; 17 | 18 | public SymbolInfo() 19 | { 20 | 21 | } 22 | public SymbolInfo(ArrayList ti, ArrayList li) 23 | { 24 | _LineInfo = li; 25 | _TextInfo = ti; 26 | } 27 | 28 | public ArrayList getTextInfoList() 29 | { 30 | return _TextInfo; 31 | } 32 | 33 | public ArrayList getLineInfoList() 34 | { 35 | return _LineInfo; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/java/sec/web/renderer/utilities/TextInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package sec.web.renderer.utilities; 6 | 7 | import java.awt.geom.Point2D; 8 | 9 | /** 10 | * 11 | * @author michael.spinelli 12 | */ 13 | public class TextInfo { 14 | private String _ModifierString = null; 15 | private Point2D _ModifierStringPosition = null; 16 | private double _ModifierStringAngle = 0; 17 | 18 | public TextInfo() 19 | { 20 | 21 | } 22 | //set this when returning text string. 23 | public void setModifierString(String value) 24 | { 25 | _ModifierString = value; 26 | } 27 | 28 | public String getModifierString() 29 | { 30 | return _ModifierString; 31 | } 32 | 33 | //location to draw ModifierString. 34 | public void setModifierStringPosition(Point2D value) 35 | { 36 | _ModifierStringPosition = value; 37 | } 38 | 39 | public Point2D getModifierStringPosition() 40 | { 41 | return _ModifierStringPosition; 42 | } 43 | 44 | //angle to draw ModifierString. 45 | public void setModifierStringAngle(double value) 46 | { 47 | _ModifierStringAngle = value; 48 | } 49 | 50 | public double getModifierStringAngle() 51 | { 52 | return _ModifierStringAngle; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/jnlp/TEMPresources/mil-sym-renderer.jnlp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | mil-sym-renderer 6 | SEC 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/jnlp/template.vm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SECRenderer 6 | SEC 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | $dependencies 21 | 22 | 23 | 24 | 25 | 26 | 27 | -spport:6789 28 | 29 | -spbacklog:0 30 | 31 | 32 | 33 | -mpport:6790 34 | 35 | -mpbacklog:0 36 | 37 | 38 | 39 | 40 | 47 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/resources/META-INF/services/ArmyC2.C2SD.RendererPluginInterface.ISinglePointRenderer: -------------------------------------------------------------------------------- 1 | sec.web.renderer.SinglePoint2525Renderer 2 | sec.web.renderer.AreaSymbolFill -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/resources/assembly/zipAssembly.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | PORTABLE 6 | / 7 | 8 | 9 | zip 10 | 11 | 12 | 13 | /target 14 | /target 15 | 16 | 17 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/resources/images/globe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/renderer/mil-sym-renderer/src/main/resources/images/globe.png -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/resources/properties/secrenderer.properties: -------------------------------------------------------------------------------- 1 | secrenderer.jnlp.jar.version:${project.version} -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | Archetype Created Web Application 7 | 8 | -------------------------------------------------------------------------------- /renderer/mil-sym-renderer/src/main/webapp/index.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Hello World!

4 | 5 | 6 | -------------------------------------------------------------------------------- /renderer/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | io.github.missioncommand 6 | mil-sym-java 7 | 0.1.43 8 | .. 9 | 10 | 11 | mil-sym-renderer-parent 12 | pom 13 | mil-sym-java :: Renderer 14 | mil-sym-java Renderer 15 | 16 | 17 | RendererPluginInterface 18 | mil-sym-renderer 19 | 20 | 21 | -------------------------------------------------------------------------------- /samples/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | io.github.missioncommand 6 | mil-sym-java 7 | 0.1.43 8 | .. 9 | 10 | 11 | mil-sym-java-samples-parent 12 | pom 13 | mil-sym-java :: Samples 14 | mil-sym-java Samples 15 | 16 | 17 | rendering-sample-1 18 | 19 | 20 | -------------------------------------------------------------------------------- /samples/rendering-sample-1/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | io.github.missioncommand 6 | mil-sym-java 7 | 0.1.43 8 | ../.. 9 | 10 | 11 | rendering-sample-1 12 | jar 13 | mil-sym-java :: Samples :: rendering-sample-1 14 | 15 | 16 | sec.web.renderer.samples.Gui 17 | 18 | 19 | 20 | 21 | io.github.missioncommand 22 | mil-sym-renderer 23 | 24 | 25 | 26 | junit 27 | junit 28 | test 29 | 30 | 31 | 32 | 33 | 34 | 35 | org.apache.maven.plugins 36 | maven-assembly-plugin 37 | 38 | 39 | package 40 | 41 | attached 42 | 43 | 44 | 45 | 46 | 47 | 48 | ${mainClass} 49 | 50 | 51 | ${project.artifactId} 52 | . 53 | 54 | 55 | 56 | jar-with-dependencies 57 | 58 | false 59 | ${project.artifactId}-executable 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /samples/rendering-sample-1/readme.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Renderer sample project 1 4 | 5 | ## About 6 | 7 | This is a basic sample of how to use the renderer. 8 | 9 | It will draw one of two single point icons on the form and it will output kml for multipoint rendering via "System.out.println()". 10 | 11 | ## Deployment 12 | 13 | This sample project gets packaged as a tradition jar file as well as an executable jar file and can be run in your jvm by using the command: `java -jar rendering-sample-1-executable.jar` 14 | 15 | ## Requirements 16 | 17 | This sample jar project was developed against the following web server: 18 | 19 | Apache Tomcat 7 20 | 21 | The JVM used to run this jar requires: 22 | 23 | Orcale Java >= 1.7 24 | 25 | ## Build Commands 26 | 27 | This is typical maven project that can be built using the following maven command: `mvn clean install` 28 | 29 | ## Libraries 30 | 31 | Libraries Used include: 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
Dependency Name
mil.army.missioncommand.mil-sym-renderer
41 | -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/java/sec/web/renderer/model/CommonURL.java: -------------------------------------------------------------------------------- 1 | package sec.web.renderer.model; 2 | 3 | public class CommonURL { 4 | 5 | private String protocol; 6 | private String host; 7 | private String port; 8 | private String contextPath; 9 | 10 | public CommonURL() { } 11 | 12 | public CommonURL(String protocol, String host, String port, String contextPath) { 13 | this.protocol = protocol; 14 | this.host = host; 15 | this.port = port; 16 | this.contextPath = contextPath; 17 | } 18 | 19 | public String getProtocol() { 20 | return protocol; 21 | } 22 | 23 | public void setProtocol(String protocol) { 24 | this.protocol = protocol; 25 | } 26 | 27 | public String getHost() { 28 | return host; 29 | } 30 | 31 | public void setHost(String host) { 32 | this.host = host; 33 | } 34 | 35 | public String getPort() { 36 | return port; 37 | } 38 | 39 | public void setPort(String port) { 40 | this.port = port; 41 | } 42 | 43 | public String getContextPath() { 44 | return contextPath; 45 | } 46 | 47 | public void setContextPath(String contextPath) { 48 | this.contextPath = contextPath; 49 | } 50 | 51 | @Override 52 | public String toString() { 53 | StringBuilder sb = new StringBuilder(); 54 | 55 | if (this.protocol != null && this.protocol != "") { 56 | sb.append(this.protocol); 57 | sb.append("://"); 58 | } 59 | 60 | if (this.host != null && this.host != "") { 61 | sb.append(this.host); 62 | } 63 | 64 | if (this.port != null && this.port != "") { 65 | sb.append(":"); 66 | sb.append(this.port); 67 | sb.append("/"); 68 | } 69 | 70 | if (this.contextPath != null && this.contextPath != "") { 71 | sb.append(this.contextPath); 72 | } 73 | 74 | return sb.toString(); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/java/sec/web/renderer/model/Plugin.java: -------------------------------------------------------------------------------- 1 | package sec.web.renderer.model; 2 | 3 | import java.io.File; 4 | 5 | public class Plugin extends CommonURL { 6 | private String pluginName; 7 | private String pluginPath; 8 | 9 | 10 | public Plugin() { 11 | super(); 12 | } 13 | 14 | public Plugin(String name, String path) { 15 | this.pluginName = name; 16 | this.pluginPath = path; 17 | } 18 | 19 | public String getName() { 20 | return pluginName; 21 | } 22 | 23 | public void setName(String name) { 24 | this.pluginName = name; 25 | } 26 | 27 | public String getPath() { 28 | return pluginPath; 29 | } 30 | 31 | public void setPath(String path) { 32 | this.pluginPath = path; 33 | } 34 | 35 | @Override 36 | public String toString() { 37 | StringBuilder sb = new StringBuilder(); 38 | sb.append(super.toString()); 39 | sb.append(this.pluginName); 40 | if (this.pluginPath != "" && this.pluginPath != null) { 41 | sb.append(File.separator); 42 | sb.append(this.pluginPath); 43 | } 44 | 45 | 46 | return sb.toString(); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/java/sec/web/renderer/model/PluginData.java: -------------------------------------------------------------------------------- 1 | package sec.web.renderer.model; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | public class PluginData { 7 | 8 | private long id = 0; 9 | 10 | private List plugins = new ArrayList(); 11 | 12 | public long getId() { 13 | return id; 14 | } 15 | 16 | public void setId(long id) { 17 | this.id = id; 18 | } 19 | 20 | public List getPlugins() { 21 | return plugins; 22 | } 23 | 24 | public void setPlugins(List plugins) { 25 | this.plugins = plugins; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/java/sec/web/renderer/model/RenderingDataEnums.java: -------------------------------------------------------------------------------- 1 | package sec.web.renderer.model; 2 | 3 | public enum RenderingDataEnums { 4 | IMAGE("image"), KML("kml"), MP3D("mp3d"), MP2D("mp2d"), SPBI("spbi"), SVG("svg"), SVGZ("svgz"); 5 | 6 | private String type; 7 | 8 | private RenderingDataEnums(String type) { 9 | this.type = type; 10 | } 11 | 12 | public String getRequestType() { 13 | return this.type; 14 | } 15 | 16 | 17 | /** 18 | * @param text 19 | * @throws This method is the same as the valueOf(String) method but gaurds against case sensitivity that could result in an 20 | * Exception in thread main java.lang.IllegalArgumentexcetiopn: No enum const class 21 | * if text does not match any enum type in this class 22 | * */ 23 | public static RenderingDataEnums fromString(String text) { 24 | RenderingDataEnums rde = null; 25 | if (text != null && text.length() > 2) { 26 | for (RenderingDataEnums enums : RenderingDataEnums.values()) { 27 | if (text.equalsIgnoreCase(enums.type)) { 28 | rde = enums; 29 | } 30 | } 31 | } 32 | return rde; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/java/sec/web/renderer/services/directory/DirectoryReaderController.java: -------------------------------------------------------------------------------- 1 | package sec.web.renderer.services.directory; 2 | 3 | import java.util.ArrayList; 4 | 5 | import javax.servlet.http.HttpServletRequest; 6 | import javax.servlet.http.HttpServletResponse; 7 | import javax.ws.rs.core.Context; 8 | 9 | import org.springframework.stereotype.Controller; 10 | import org.springframework.web.bind.annotation.PathVariable; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RequestMethod; 13 | import org.springframework.web.bind.annotation.RequestParam; 14 | import org.springframework.web.bind.annotation.ResponseBody; 15 | 16 | import sec.web.renderer.services.directory.listeners.DirectoryWatcherVJ6; 17 | import sec.web.renderer.utils.IoUtilities; 18 | 19 | @Controller 20 | /** 21 | * @deprecated 22 | * 23 | */ 24 | public class DirectoryReaderController { 25 | 26 | public DirectoryReaderController() { } 27 | 28 | @RequestMapping(value="/pluginList", method = RequestMethod.GET) 29 | @ResponseBody 30 | public String getContent(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestParam(value="type", defaultValue="delimited") String type) { 31 | String result = ""; 32 | String baseUrl = request.getRequestURL().toString().replace(request.getRequestURI().substring(1), request.getContextPath()); 33 | 34 | try { 35 | /* Comma delimited String */ 36 | String dirContents = ""; //= utils.getContentAsString(','); 37 | 38 | ArrayList fileList = DirectoryWatcherVJ6.scheduler.getFileNames(); 39 | 40 | if (type.equalsIgnoreCase("delimited")) { 41 | dirContents = IoUtilities.buildUrlDelimitedList(fileList, ',', baseUrl); 42 | } else { 43 | dirContents = IoUtilities.buildJsonUrlList(fileList, baseUrl); 44 | } 45 | 46 | if (!"".equals(dirContents) || dirContents != null) { 47 | result = dirContents; 48 | } 49 | } catch (Exception ioe) { 50 | ioe.printStackTrace(); 51 | } 52 | 53 | return result; 54 | } 55 | 56 | @RequestMapping(value="/message/{msg}", method = RequestMethod.GET) 57 | @ResponseBody 58 | public String getMessage(@PathVariable String msg) { 59 | 60 | return msg; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/java/sec/web/renderer/services/directory/DirectoryReaderServlet.java: -------------------------------------------------------------------------------- 1 | package sec.web.renderer.services.directory; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | import java.io.PrintWriter; 6 | import java.util.List; 7 | import java.util.Properties; 8 | import java.util.logging.Level; 9 | import java.util.logging.Logger; 10 | 11 | import javax.servlet.ServletException; 12 | import javax.servlet.annotation.WebServlet; 13 | import javax.servlet.http.HttpServlet; 14 | import javax.servlet.http.HttpServletRequest; 15 | import javax.servlet.http.HttpServletResponse; 16 | 17 | import sec.web.renderer.utils.DirectoryReaderUtils; 18 | 19 | /** 20 | * Servlet implementation class DirectoryReader 21 | * @deprecated 22 | * 23 | */ 24 | @WebServlet(name = "sec-directory-reader", urlPatterns = { "/directoryReader" }) 25 | public class DirectoryReaderServlet extends HttpServlet { 26 | private static final long serialVersionUID = 534810784725663803L; 27 | private static final Logger LOGGER = Logger.getLogger(DirectoryReaderServlet.class.getName()); 28 | private Properties props; 29 | 30 | /** 31 | * @see HttpServlet#HttpServlet() 32 | */ 33 | public DirectoryReaderServlet() { 34 | super(); 35 | 36 | props = DirectoryReaderUtils.loadProperties("properties/prop.properties", this.getClass().getClassLoader()); 37 | } 38 | 39 | /** 40 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 41 | */ 42 | @SuppressWarnings("unused") 43 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 44 | try { 45 | response.setContentType("application/json"); 46 | PrintWriter writer = response.getWriter(); 47 | String urlStr = buildURL(request.getServerName(), String.valueOf(request.getServerPort())); 48 | 49 | StringBuilder filePath = new StringBuilder(); 50 | filePath.append(props.getProperty("directoryPath")); 51 | filePath.append(File.separator); 52 | filePath.append(props.getProperty("directoryName")); 53 | filePath.append(File.separator); 54 | 55 | /* Comma delimited String */ 56 | String contents = DirectoryReaderUtils.getDirectoryContent(new File(filePath.toString())); 57 | 58 | writer.println(contents); 59 | 60 | } catch (Exception e) { 61 | LOGGER.log(Level.WARNING, e.getMessage()); 62 | } 63 | } 64 | 65 | private String buildURL(String serverName, String port) { 66 | String urlStr = props.getProperty("protocol") + "://" + 67 | serverName + ":" + 68 | port + "/" + 69 | props.getProperty("directoryName"); 70 | return urlStr; 71 | } 72 | 73 | 74 | protected String makeHtmlResponse(List contents) { 75 | StringBuilder sb = new StringBuilder(); 76 | sb.append("

Content of Resources folder


"); 77 | sb.append(""); 86 | 87 | return sb.toString(); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/java/sec/web/renderer/services/directory/listeners/DirectoryReaderTaskScheduler.java: -------------------------------------------------------------------------------- 1 | package sec.web.renderer.services.directory.listeners; 2 | 3 | import java.util.ArrayList; 4 | import java.util.concurrent.Executors; 5 | import java.util.concurrent.ScheduledExecutorService; 6 | import java.util.concurrent.TimeUnit; 7 | import java.util.logging.Level; 8 | import java.util.logging.Logger; 9 | 10 | /** 11 | * 12 | * @author User 13 | * @deprecated 14 | */ 15 | public class DirectoryReaderTaskScheduler { 16 | private final static Logger LOGGER = Logger.getLogger(DirectoryReaderTaskScheduler.class.getName()); 17 | 18 | private ReadDirectoryTimerTask timeTask; 19 | private final int NO_DELAY = 0; 20 | public ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor(); 21 | 22 | public void startTimer(String path, int interval) { 23 | timeTask = new ReadDirectoryTimerTask(path); 24 | service.scheduleAtFixedRate(timeTask, NO_DELAY, interval, TimeUnit.MILLISECONDS); 25 | System.out.println("timer has been scheduled to watch " + path + " for every " + interval + " milliseconds"); 26 | } 27 | 28 | public void stopTimer() { 29 | LOGGER.log(Level.INFO, "Timer shutdown initiated"); 30 | service.shutdown(); 31 | } 32 | 33 | public synchronized ArrayList getFileNames() { 34 | ArrayList temp = new ArrayList(); 35 | if (this.timeTask != null) { 36 | temp = timeTask.getFileNames(); 37 | } 38 | return temp; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/java/sec/web/renderer/services/directory/listeners/DirectoryWatcherVJ6.java: -------------------------------------------------------------------------------- 1 | package sec.web.renderer.services.directory.listeners; 2 | 3 | import java.util.Calendar; 4 | import java.util.Properties; 5 | import java.util.logging.Level; 6 | import java.util.logging.Logger; 7 | 8 | import javax.servlet.ServletContextEvent; 9 | import javax.servlet.ServletContextListener; 10 | 11 | import sec.web.renderer.utils.IoUtilities; 12 | 13 | /** 14 | * @deprecated 15 | * @author User 16 | */ 17 | public class DirectoryWatcherVJ6 implements ServletContextListener { 18 | public static final Logger LOGGER = Logger.getLogger(DirectoryWatcherVJ6.class.getName()); 19 | public static DirectoryReaderTaskScheduler scheduler = new DirectoryReaderTaskScheduler(); 20 | public final int INTERVAL = 60 * 1000; 21 | 22 | @Override 23 | public void contextDestroyed(ServletContextEvent sce) { 24 | scheduler.stopTimer(); 25 | } 26 | 27 | @Override 28 | public void contextInitialized(ServletContextEvent sce) { 29 | //TODO: generate default properties file 30 | 31 | Properties props = IoUtilities.getProperties(); 32 | StringBuilder filePath = new StringBuilder(); 33 | filePath.append(props.getProperty("directoryPath")); 34 | 35 | scheduler.startTimer(filePath.toString(), INTERVAL); 36 | 37 | LOGGER.log(Level.INFO, "Timer Initialized"); 38 | LOGGER.log(Level.INFO, "\n\n\n" + new String("starting folder timer ").toUpperCase() 39 | + Calendar.getInstance().getTime().toString() 40 | + "\n\n\n"); 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/java/sec/web/renderer/services/directory/listeners/ReadDirectoryTimerTask.java: -------------------------------------------------------------------------------- 1 | package sec.web.renderer.services.directory.listeners; 2 | 3 | import java.io.File; 4 | import java.util.ArrayList; 5 | import java.util.TimerTask; 6 | 7 | import sec.web.renderer.utils.ImagingUtils; 8 | 9 | /** 10 | * @deprecated 11 | * @author User 12 | */ 13 | public class ReadDirectoryTimerTask extends TimerTask { 14 | private String directoryPath; 15 | private ArrayList fileNames = new ArrayList(); 16 | 17 | public ReadDirectoryTimerTask(String dirPath) { 18 | directoryPath = dirPath; 19 | } 20 | 21 | @Override 22 | public void run() { 23 | try { 24 | // retain old list of plugins 25 | ArrayList oldList = new ArrayList(); 26 | oldList.addAll(fileNames); 27 | 28 | // clear current list and rebuild 29 | clear(); 30 | File dirToRead = new File(this.directoryPath); 31 | File[] files = dirToRead.listFiles(); 32 | 33 | if (files != null) { 34 | for (File f : files) { 35 | fileNames.add(f.getName()); 36 | // System.out.printf("adding:\t%s\n", f.getAbsolutePath()); 37 | } 38 | } 39 | 40 | // compare original and updated list to see if there are differences. If so, reload the plugins. 41 | int oldSize = oldList.size(); 42 | 43 | oldList.retainAll(fileNames); 44 | if (oldSize != fileNames.size()) { 45 | // System.out.println("reloading plugins!"); 46 | ImagingUtils.reloadPlugins(); 47 | } 48 | 49 | } catch (Exception exception) { 50 | exception.printStackTrace(); 51 | } 52 | } 53 | 54 | 55 | private void clear() { 56 | if (!this.fileNames.isEmpty()) { 57 | this.fileNames.clear(); 58 | } 59 | } 60 | 61 | public ArrayList getFileNames() { 62 | return this.fileNames; 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/java/sec/web/renderer/services/imaging/ImageGeneratorServlet.java: -------------------------------------------------------------------------------- 1 | package sec.web.renderer.services.imaging; 2 | 3 | import java.io.IOException; 4 | import java.io.OutputStream; 5 | import java.io.PrintWriter; 6 | import java.util.logging.Level; 7 | import java.util.logging.Logger; 8 | 9 | import javax.servlet.ServletException; 10 | import javax.servlet.annotation.WebServlet; 11 | import javax.servlet.http.HttpServlet; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | 15 | import sec.web.renderer.utils.ImagingUtils; 16 | 17 | /** 18 | * Servlet implementation class DirectoryReader 19 | */ 20 | @WebServlet(name = "sec-image-generator-servlet", urlPatterns = { "/kml/symbolID" }) 21 | public class ImageGeneratorServlet extends HttpServlet { 22 | private static final long serialVersionUID = 851369047318854091L; 23 | private static final Logger LOGGER = Logger.getLogger(ImageGeneratorServlet.class.getName()); 24 | 25 | /** 26 | * @see HttpServlet#HttpServlet() 27 | */ 28 | public ImageGeneratorServlet() { 29 | super(); 30 | } 31 | 32 | /** 33 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse 34 | * response) 35 | */ 36 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 37 | OutputStream os = response.getOutputStream(); 38 | 39 | try { 40 | response.setContentType("image/png"); 41 | 42 | byte[] pngResponse = ImagingUtils.getMilStd2525Png(request.getRequestURI(), request.getQueryString()); 43 | 44 | if (pngResponse == null) { 45 | response.setStatus(HttpServletResponse.SC_BAD_REQUEST); 46 | throw new Exception(); 47 | } 48 | 49 | os.write(pngResponse); 50 | os.close(); 51 | 52 | } catch (Exception exc) { 53 | LOGGER.log(Level.SEVERE, this.getClass().getName() + exc.getMessage()); 54 | response.setContentType("text/plain"); 55 | PrintWriter out = response.getWriter(); 56 | out.println(genHtmlErrorPage(request.getContextPath())); 57 | out.close(); 58 | } 59 | } 60 | 61 | private String genHtmlErrorPage(String ctxPath) { 62 | StringBuilder sb = new StringBuilder(); 63 | 64 | sb.append(""); 65 | sb.append(""); 66 | sb.append("503"); 67 | sb.append(""); 68 | 69 | sb.append(""); 70 | sb.append("

Servlet SinglePoint at " + ctxPath + "

"); 71 | sb.append("
url: " + "test" + "
"); 72 | sb.append(""); 73 | sb.append(""); 74 | 75 | 76 | return sb.toString(); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/java/sec/web/renderer/services/imaging/SECRendererImpl.java: -------------------------------------------------------------------------------- 1 | package sec.web.renderer.services.imaging; 2 | 3 | import sec.web.renderer.SECRenderer; 4 | import sec.web.renderer.utilities.PNGInfo; 5 | 6 | public class SECRendererImpl { 7 | protected static SECRenderer sr; 8 | 9 | public SECRendererImpl() { 10 | sr = SECRenderer.getInstance(); 11 | //sr.matchSECWebRendererAppletDefaultRendererSettings(); 12 | } 13 | 14 | 15 | public static byte[] getMilStd2525Png(String symbolId, String queryString) { 16 | String path = symbolId; 17 | 18 | if (queryString != null || "".equals(queryString)) { 19 | path += "?" + queryString; 20 | } 21 | 22 | PNGInfo pngInfo = sr.getMilStdSymbolImageFromURL(path); 23 | byte[] pngResponse = (pngInfo == null) ? null : pngInfo.getImageAsByteArray(); 24 | 25 | return pngResponse; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/java/sec/web/renderer/services/ping/PingServiceController.java: -------------------------------------------------------------------------------- 1 | package sec.web.renderer.services.ping; 2 | 3 | import java.io.IOException; 4 | 5 | import javax.servlet.http.HttpServletResponse; 6 | import javax.ws.rs.core.Context; 7 | 8 | import org.springframework.stereotype.Controller; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RequestMethod; 11 | import org.springframework.web.bind.annotation.ResponseBody; 12 | 13 | @Controller 14 | public class PingServiceController { 15 | 16 | public PingServiceController() { 17 | } 18 | 19 | @RequestMapping(value = "/ping", method = RequestMethod.GET) 20 | @ResponseBody 21 | public void ping(@Context HttpServletResponse response) { 22 | 23 | try { 24 | response.setContentType("text/html"); 25 | response.setStatus(HttpServletResponse.SC_OK); 26 | response.getOutputStream().println(response.getStatus()); 27 | 28 | // response.getOutputStream().close(); 29 | } catch (IOException e) { 30 | e.printStackTrace(); 31 | } 32 | 33 | // return response.getStatus(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/java/sec/web/renderer/services/ping/PingServiceServlet.java: -------------------------------------------------------------------------------- 1 | package sec.web.renderer.services.ping; 2 | 3 | import java.io.IOException; 4 | import java.util.Calendar; 5 | import java.util.logging.Level; 6 | import java.util.logging.Logger; 7 | 8 | import javax.servlet.ServletException; 9 | import javax.servlet.ServletOutputStream; 10 | import javax.servlet.annotation.WebServlet; 11 | import javax.servlet.http.HttpServlet; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | 15 | /** 16 | * Servlet implementation class DirectoryReader 17 | */ 18 | @WebServlet(name = "sec-ping-service-servlet", urlPatterns = { "/ping" }) 19 | public class PingServiceServlet extends HttpServlet { 20 | private static final long serialVersionUID = 1798608294319568590L; 21 | private static final Logger LOGGER = Logger.getLogger(PingServiceServlet.class.getName()); 22 | 23 | /** 24 | * @see HttpServlet#HttpServlet() 25 | */ 26 | public PingServiceServlet() { 27 | super(); 28 | } 29 | 30 | /** 31 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse 32 | * response) 33 | */ 34 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 35 | ServletOutputStream os = response.getOutputStream(); 36 | LOGGER.log(Level.INFO, "ping:\t" + Calendar.getInstance().getTime()); 37 | 38 | response.setContentType("text/html"); 39 | response.setStatus(HttpServletResponse.SC_OK); 40 | 41 | String pageResult = genHtmlPage(response.getStatus()); 42 | 43 | os.println(pageResult); 44 | os.close(); 45 | } 46 | 47 | private String genHtmlPage(int statusCode) { 48 | StringBuilder sb = new StringBuilder(); 49 | 50 | sb.append(""); 51 | sb.append(""); 52 | sb.append("Mil-Symbology-Renderer Availability Page"); 53 | sb.append(""); 63 | sb.append(""); 64 | 65 | sb.append(""); 66 | sb.append("

Service is up and running:\t" + statusCode + "

"); 67 | sb.append(""); 68 | sb.append(""); 69 | 70 | 71 | return sb.toString(); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/java/sec/web/renderer/utils/DirectoryReaderUtils.java: -------------------------------------------------------------------------------- 1 | package sec.web.renderer.utils; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | import java.io.InputStream; 6 | import java.util.Properties; 7 | import java.util.logging.Level; 8 | import java.util.logging.Logger; 9 | 10 | public class DirectoryReaderUtils { 11 | private final static Logger LOGGER = Logger.getLogger(DirectoryReaderUtils.class.getName()); 12 | 13 | public DirectoryReaderUtils() { 14 | 15 | } 16 | 17 | public static String getDirectoryContent(File dir) throws IOException { 18 | StringBuilder sb = new StringBuilder(); 19 | System.out.println(dir.getAbsolutePath()); 20 | 21 | if (!dir.exists()) { 22 | dir.mkdirs(); 23 | System.out.println("location does not exists ... Creating " + dir.getAbsolutePath()); 24 | } 25 | 26 | if (dir.isDirectory()) { 27 | File[] files = dir.listFiles(); 28 | for (File f : files) { 29 | sb.append(f.getName()); 30 | sb.append(","); 31 | } 32 | } 33 | 34 | if (sb.toString().length() <= 0) { 35 | throw new IOException("NO plugins were found at:\t" + dir.getAbsolutePath()); 36 | } 37 | 38 | return sb.substring(0, sb.toString().lastIndexOf(',')); 39 | } 40 | 41 | 42 | public static Properties loadProperties(String fileName, ClassLoader loader) { 43 | Properties props = new Properties(); 44 | if (fileName == null || fileName.equals("")) { 45 | throw new IllegalArgumentException("null reference: " + fileName); 46 | } 47 | if (fileName.startsWith("/")) { 48 | fileName = fileName.substring(1); 49 | } 50 | 51 | InputStream inStream = null; 52 | try { 53 | if (loader == null) { 54 | loader = ClassLoader.getSystemClassLoader(); 55 | } 56 | 57 | inStream = loader.getResourceAsStream(fileName); 58 | props.load(inStream); 59 | 60 | } catch (IOException ioe) { 61 | LOGGER.log(Level.WARNING, ioe.getMessage()); 62 | ioe.printStackTrace(); 63 | } 64 | return props; 65 | } 66 | 67 | /** 68 | * @param dir 69 | */ 70 | public static void emptyDirectory(File dir) { 71 | if (dir.exists() && dir.isDirectory()) { 72 | File[] tmpFiles = dir.listFiles(); 73 | 74 | if (tmpFiles.length > 0) { 75 | for (File f : tmpFiles) { 76 | f.delete(); 77 | } 78 | } 79 | } 80 | } 81 | 82 | /** 83 | * @param dir 84 | * @throws IOException 85 | */ 86 | public static boolean isEmpty(File dir) throws IOException { 87 | boolean isEmpty = false; 88 | 89 | if (!dir.exists()) { 90 | LOGGER.log(Level.SEVERE, "Directory does NOT exist at " + dir.getAbsolutePath()); 91 | throw new IOException("Directory does NOT exist at " + dir.getAbsolutePath()); 92 | } else if ( !dir.isDirectory() ) { 93 | LOGGER.log(Level.SEVERE, dir.getAbsolutePath() + " is not a directory"); 94 | throw new IOException(dir.getAbsolutePath() + " is not a directory"); 95 | } 96 | 97 | isEmpty = (dir.listFiles().length <= 0) ? isEmpty = true : isEmpty; 98 | 99 | return isEmpty; 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/java/sec/web/renderer/utils/MultiPointUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package sec.web.renderer.utils; 6 | 7 | import ArmyC2.C2SD.Utilities.ErrorLogger; 8 | 9 | import java.util.Map; 10 | 11 | import sec.web.renderer.SECRenderer; 12 | 13 | /** 14 | * 15 | * @author michael.spinelli 16 | */ 17 | public class MultiPointUtils { 18 | 19 | public static String RenderSymbol(String symbolID, Map params) { 20 | String returnVal = ""; 21 | String id = "ID"; 22 | String name = "NAME"; 23 | String description = "DESCRIPTION"; 24 | // String symbolID 25 | String controlPoints = "0,0"; 26 | String altitudeMode = "clampToGround"; 27 | double scale = 50000; 28 | String bbox = ""; 29 | String modifiers = ""; 30 | int format = 0; 31 | int symStd = 0; 32 | boolean debug = false; 33 | try { 34 | if (params.containsKey("ID")) 35 | id = params.get("ID"); 36 | if (params.containsKey("NAME")) 37 | name = params.get("NAME"); 38 | if (params.containsKey("DESCRIPTION")) 39 | description = params.get("DESCRIPTION"); 40 | if (params.containsKey("CONTROLPOINTS")) 41 | controlPoints = params.get("CONTROLPOINTS"); 42 | if (params.containsKey("ALTITUDEMODE")) 43 | altitudeMode = params.get("ALTITUDEMODE"); 44 | if (params.containsKey("SCALE")) 45 | scale = Double.parseDouble(params.get("SCALE")); 46 | if (params.containsKey("BBOX")) 47 | bbox = params.get("BBOX"); 48 | if (params.containsKey("MODIFIERS")) 49 | modifiers = params.get("MODIFIERS"); 50 | if (params.containsKey("FORMAT")) 51 | format = Integer.parseInt(params.get("FORMAT")); 52 | if (params.containsKey("SYMSTD")) 53 | symStd = Integer.parseInt(params.get("SYMSTD")); 54 | 55 | if (debug) { 56 | System.out.println("SymbolID: " + symbolID); 57 | System.out.println("Param values:"); 58 | System.out.println(ErrorLogger.PrintStringMap(params)); 59 | } 60 | 61 | returnVal = SECRenderer.getInstance().RenderMultiPointSymbol(id, name, description, symbolID, controlPoints, 62 | altitudeMode, scale, bbox, modifiers, format, symStd); 63 | } catch (Exception exc) { 64 | System.err.println(exc.getMessage()); 65 | exc.printStackTrace(); 66 | } 67 | if (debug) { 68 | // System.out.println("MultiPointUtils.RenderSymbol() return: "); 69 | // System.out.println(returnVal); 70 | } 71 | return returnVal; 72 | } 73 | 74 | @SuppressWarnings("unused") 75 | public static String RenderSymbol2D(String symbolID, Map params) { 76 | String returnVal = ""; 77 | String id = "ID"; 78 | String name = "NAME"; 79 | String description = "DESCRIPTION"; 80 | // String symbolID 81 | String controlPoints = "0,0"; 82 | String altitudeMode = "clampToGround"; 83 | double scale = 50000; 84 | String bbox = ""; 85 | String modifiers = ""; 86 | int pixelWidth = 1280; 87 | int pixelHeight = 1024; 88 | int format = 0; 89 | int symStd = 0; 90 | boolean debug = false; 91 | try { 92 | if (params.containsKey("ID")) 93 | id = params.get("ID"); 94 | if (params.containsKey("NAME")) 95 | name = params.get("NAME"); 96 | if (params.containsKey("DESCRIPTION")) 97 | description = params.get("DESCRIPTION"); 98 | if (params.containsKey("CONTROLPOINTS")) 99 | controlPoints = params.get("CONTROLPOINTS"); 100 | if (params.containsKey("PIXELWIDTH")) 101 | scale = Integer.parseInt(params.get("PIXELWIDTH")); 102 | if (params.containsKey("PIXELHEIGHT")) 103 | scale = Integer.parseInt(params.get("PIXELHEIGHT")); 104 | if (params.containsKey("BBOX")) 105 | bbox = params.get("BBOX"); 106 | if (params.containsKey("MODIFIERS")) 107 | modifiers = params.get("MODIFIERS"); 108 | if (params.containsKey("FORMAT")) 109 | format = Integer.parseInt(params.get("FORMAT")); 110 | if (params.containsKey("SYMSTD")) 111 | symStd = Integer.parseInt(params.get("SYMSTD")); 112 | 113 | if (debug) { 114 | System.out.println("SymbolID: " + symbolID); 115 | System.out.println("Param values:"); 116 | System.out.println(ErrorLogger.PrintStringMap(params)); 117 | } 118 | 119 | returnVal = SECRenderer.getInstance().RenderMultiPointSymbol2D(id, name, description, symbolID, controlPoints, 120 | pixelWidth, pixelHeight, bbox, modifiers, format, symStd); 121 | } catch (Exception exc) { 122 | System.err.println(exc.getMessage()); 123 | exc.printStackTrace(); 124 | } 125 | if (debug) { 126 | // System.out.println("MultiPointUtils.RenderSymbol() return: "); 127 | // System.out.println(returnVal); 128 | } 129 | return returnVal; 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/java/sec/web/renderer/utils/ResourceUtils.java: -------------------------------------------------------------------------------- 1 | package sec.web.renderer.utils; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.util.Properties; 6 | import java.util.logging.Level; 7 | import java.util.logging.Logger; 8 | 9 | 10 | public class ResourceUtils { 11 | public static final Logger LOGGER = Logger.getLogger(ResourceUtils.class.getName()); 12 | 13 | public static Properties loadResource(String fileName) { 14 | return loadResource(fileName, null); 15 | } 16 | 17 | public static Properties loadResource(String fileName, ClassLoader loader) { 18 | Properties props = new Properties(); 19 | if (fileName == null || fileName.equals("")) { 20 | throw new IllegalArgumentException("null reference: " + fileName); 21 | } 22 | if (fileName.startsWith("/")) { 23 | fileName = fileName.substring(1); 24 | } 25 | 26 | InputStream inStream = null; 27 | try { 28 | if (loader == null) { 29 | loader = ClassLoader.getSystemClassLoader(); 30 | } 31 | 32 | inStream = loader.getResourceAsStream(fileName); 33 | props.load(inStream); 34 | 35 | } catch (IOException ioe) { 36 | LOGGER.log(Level.WARNING, ioe.getMessage()); 37 | ioe.printStackTrace(); 38 | } 39 | return props; 40 | } 41 | 42 | public static boolean isPluginsEnabled() { 43 | Properties props = loadResource("properties/prop.properties", null); 44 | Boolean enabled = Boolean.valueOf((String)props.get("enablePlugins")); 45 | boolean enablePlugins = (enabled == null) ? true : enabled; 46 | 47 | return enablePlugins; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/resources/assembly/zip.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | jsDocs 6 | 7 | zip 8 | 9 | 10 | 11 | 12 | ${project.build.directory}/site/jsdoc 13 | jsdocs 14 | 15 | 16 | -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/resources/properties/prop.properties: -------------------------------------------------------------------------------- 1 | #enablePlugins 2 | #if true, "mil-sym-service/plugins" folder will be created at the same level as 3 | #webapps if it doesn't already exist. 4 | #if false, no folder will be created and there will be no attempt to 5 | #load plugins. 6 | enablePlugins=false 7 | #0=2525B,1=2525C,2=2525D(in the future; highest level of support is C currently) 8 | #This is just a default setting. It can be overridden by adding the symstd 9 | #parameter to the url like "?symstd=2525C". 10 | symStd=0 11 | #textBackgroundMethod 12 | #0=NONE, 1=Color Filled Rectangle behind the text, 2=Outline, 3 = Quick Outline 13 | textBackgroundMethod=3 14 | #autoCollapseModifiers 15 | #true, fire support areas will only show identifying label and labels that fit 16 | #the area. false, all labels are shown all the time. 17 | autoCollapseModifiers=false 18 | #operationalConditionModifierType 19 | #0=Slash, 1=Bars 20 | operationalConditionModifierType=1 -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/WEB-INF/dispatch-servlet.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | Spring Web MVC Application 9 | 10 | 11 | index.jsp 12 | 13 | 14 | 15 | dispatch 16 | org.springframework.web.servlet.DispatcherServlet 17 | 1 18 | 19 | 20 | 21 | dispatch 22 | /renderer/* 23 | 24 | 25 | 26 | contextConfigLocation 27 | /WEB-INF/dispatch-servlet.xml 28 | 29 | 30 | 31 | org.springframework.web.context.ContextLoaderListener 32 | 33 | 34 | sec.web.renderer.services.directory.listeners.DirectoryWatcherVJ6 35 | 36 | -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/WEB-INF/wro/wro.properties: -------------------------------------------------------------------------------- 1 | #List of preProcessors 2 | preProcessors=jsMin,cssImport,semicolonAppender 3 | #List of postProcessors 4 | postProcessors=cssMin,jsMin -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/WEB-INF/wro/wro.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | /js/*.js 7 | 8 | 9 | 10 | /js/*.debug.js 11 | 12 | 13 | 14 | /js/mil-symbology-renderer.debug.js 15 | /js/cpce3d-js-utils.debug.js 16 | /js/cpce3d-geo-library.debug.js 17 | /js/cpce3d-geo-json-parser.debug.js 18 | /js/cpce3d-data-explorer.debug.js 19 | /js/cpce3d-data-manager.debug.js 20 | /js/cpce3d-wms-manager.debug.js 21 | /js/cpce3d-map-tools.debug.js 22 | /js/jc2cui-map-api-manager.debug.js 23 | /js/core-map-api-manager.debug.js 24 | /js/cpce3d-context-menu.debug.js 25 | /js/cpce3d-page-utils.debug.js 26 | 27 | 28 | -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/WebServiceSinglePoints.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | SHGPUCDM------- 10 | 11 | SHGPUCDM------- 12 | SHGPUCDM------- 13 | SHGPUCDM------- 14 |
15 | 20 |
21 | SUPPS 22 | SUPPS 23 | SUPPS---------- 24 |
25 | SFGPUCDM 26 |
27 | SFGPUCDM 28 |
29 | SFGPUCDM 30 |
31 | Arson 2525C 32 |
33 | Arson 2525B 34 |
35 | Check Point 36 |
37 | Bridge 38 |
39 |
40 | SymbolFill 41 |
42 | SymbolFill - clipped 43 |
44 | SymbolFill 45 | 46 | 60 |
61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/css/images/ui-bg_flat_0_aaaaaa_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/service/mil-sym-service/src/main/webapp/css/images/ui-bg_flat_0_aaaaaa_40x100.png -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/css/images/ui-bg_flat_100_262b30_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/service/mil-sym-service/src/main/webapp/css/images/ui-bg_flat_100_262b30_40x100.png -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/css/images/ui-bg_flat_100_646c76_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/service/mil-sym-service/src/main/webapp/css/images/ui-bg_flat_100_646c76_40x100.png -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/css/images/ui-bg_flat_100_747c88_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/service/mil-sym-service/src/main/webapp/css/images/ui-bg_flat_100_747c88_40x100.png -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/css/images/ui-bg_flat_100_8892a1_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/service/mil-sym-service/src/main/webapp/css/images/ui-bg_flat_100_8892a1_40x100.png -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/css/images/ui-bg_flat_75_646c76_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/service/mil-sym-service/src/main/webapp/css/images/ui-bg_flat_75_646c76_40x100.png -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/css/images/ui-bg_glass_55_fbf9ee_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/service/mil-sym-service/src/main/webapp/css/images/ui-bg_glass_55_fbf9ee_1x400.png -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/css/images/ui-bg_inset-soft_95_fef1ec_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/service/mil-sym-service/src/main/webapp/css/images/ui-bg_inset-soft_95_fef1ec_1x100.png -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/css/images/ui-icons_2e83ff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/service/mil-sym-service/src/main/webapp/css/images/ui-icons_2e83ff_256x240.png -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/css/images/ui-icons_cd0a0a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/service/mil-sym-service/src/main/webapp/css/images/ui-icons_cd0a0a_256x240.png -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/css/images/ui-icons_ffffff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/service/mil-sym-service/src/main/webapp/css/images/ui-icons_ffffff_256x240.png -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/css/min/mil-symbology-renderer-all.css: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/css/test/imageTbl.css: -------------------------------------------------------------------------------- 1 | /* ------------------ 2 | styling for the tables 3 | ------------------ */ 4 | 5 | #background-image { 6 | font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif; 7 | font-size: 12px; 8 | margin: 15px; 9 | /*width: auto;*/ 10 | text-align: middle; 11 | border-collapse: collapse; 12 | background: url('images/armyRanks.jpg') 765px 80px no-repeat; 13 | } 14 | 15 | #background-image th { 16 | padding: 12px; 17 | font-weight: normal; 18 | font-size: 14px; 19 | color: #339; 20 | white-space: nowrap; 21 | } 22 | 23 | #background-image td { 24 | padding: 9px 12px; 25 | color: #669; 26 | border-top: 1px solid #fff; 27 | } 28 | 29 | .urlField { 30 | padding: 9px 12px; 31 | color: #669; 32 | /*white-space: nowrap;*/ 33 | border-top: 1px solid #fff; 34 | } 35 | 36 | #background-image tfoot td { 37 | font-size: 11px; 38 | } 39 | #background-image tbody td { 40 | background: url('images/back.png'); 41 | } 42 | 43 | * html #background-image tbody td { 44 | /* 45 | ---------------------------- 46 | PUT THIS ON IE6 ONLY STYLE 47 | AS THE RULE INVALIDATES 48 | YOUR STYLESHEET 49 | ---------------------------- 50 | */ 51 | filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='css/test/images/back.png',sizingMethod='crop'); 52 | background: none; 53 | } 54 | 55 | #background-image tbody tr:hover td { 56 | color: #339; 57 | background: none; 58 | } -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/css/test/images/armyRanks.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/service/mil-sym-service/src/main/webapp/css/test/images/armyRanks.jpg -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/css/test/images/armyStar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/service/mil-sym-service/src/main/webapp/css/test/images/armyStar.jpg -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/css/test/images/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/service/mil-sym-service/src/main/webapp/css/test/images/back.png -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/css/test/images/bullet_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/service/mil-sym-service/src/main/webapp/css/test/images/bullet_green.png -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/css/test/images/bullet_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/service/mil-sym-service/src/main/webapp/css/test/images/bullet_red.png -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/css/test/images/button_bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/service/mil-sym-service/src/main/webapp/css/test/images/button_bg.gif -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/css/test/images/cecom-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/service/mil-sym-service/src/main/webapp/css/test/images/cecom-logo.png -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/css/test/images/input_bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/service/mil-sym-service/src/main/webapp/css/test/images/input_bg.gif -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/css/test/main.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #FFFFFF; 3 | font-family: "Lucinda Grande", "lucinda Sans Unicode", Lucinda, Arial,Hlevetica, sans-serif; 4 | font-size: 16px; 5 | margin: 0; 6 | } 7 | 8 | h1.title { 9 | background-color: #3665BB; 10 | color: #FFFFFF; 11 | padding-left: 15px; 12 | padding-right: 15px; 13 | } 14 | 15 | h2 { 16 | color: #021C4D; 17 | margin-bottom: 5px; 18 | margin-top: 10px; 19 | } 20 | 21 | .h2_content { 22 | margin-left: 10px; 23 | } 24 | 25 | h3 { 26 | color: #1A3059; 27 | margin-bottom: 5px; 28 | } 29 | 30 | .h3_content { 31 | margin-left: 10px; 32 | } 33 | 34 | a.external { 35 | color: #D0345E; 36 | } 37 | 38 | canvas { 39 | border: 1px dotted gray; 40 | } 41 | 42 | #container { 43 | margin-left: auto; 44 | margin-right: auto; 45 | margin-top: 0px; 46 | position: relative; 47 | width: 1100px; 48 | } 49 | 50 | #header { 51 | background-color: #3665BB; 52 | border-top-left-radius: 10px; 53 | border-top-right-radius: 10px; 54 | margin-bottom: 0; 55 | padding-bottom: 0; 56 | padding-top: 5px; 57 | } 58 | 59 | .todo { 60 | background-color: yellow; 61 | } 62 | 63 | .nav { 64 | background-color: #597CBB; 65 | color: white; 66 | height: 30px; 67 | padding-left: 15px; 68 | padding-top: 7px; 69 | } 70 | 71 | .nav>a { 72 | color: white; 73 | padding: 2px 4px; 74 | text-decoration: none; 75 | } 76 | 77 | .nav a.selected { 78 | background-color: #1A3059; 79 | color: white; 80 | padding: 2px 4px; 81 | text-decoration: none; 82 | } 83 | 84 | .nav a:hover { 85 | background-color: #A1002B; 86 | color: white; 87 | padding: 2px 4px; 88 | text-decoration: none; 89 | } 90 | 91 | #content { 92 | background-color: white; 93 | border-bottom-left-radius: 10px; 94 | border-bottom-right-radius: 10px; 95 | border: 2px solid; 96 | border-color: #597CBB; 97 | margin-bottom: 10px; 98 | margin-top: 0; 99 | min-height: 200px; 100 | padding: 20px 15px; 101 | } 102 | 103 | #footer { 104 | color: #021C4D; 105 | font-size: 10px; 106 | margin-bottom: 20px; 107 | margin-top: 50px; 108 | text-align: center; 109 | } 110 | 111 | #footer a { 112 | color: gray; 113 | text-decoration: none; 114 | } 115 | 116 | /*Form*/ 117 | form { 118 | width: 400px; 119 | border: none; 120 | padding: 10px; 121 | margin-left: 16px; 122 | } 123 | 124 | 125 | 126 | .blue { 127 | color: #0099CC; 128 | font-weight: bold; 129 | } 130 | 131 | /*General styles - NOT really related to the forms*/ 132 | img { 133 | border: 0; 134 | } 135 | 136 | /* Forms defaults - change as needed */ 137 | label { 138 | color: #999; 139 | cursor: pointer; 140 | padding-left: 2px; 141 | line-height: 26px; 142 | } 143 | 144 | label.chosen { 145 | color: #333; 146 | } 147 | 148 | 149 | 150 | Transparent items 151 | .outtaHere { 152 | position: absolute; 153 | left: -3000px; 154 | } 155 | 156 | table.t1 { 157 | margin: 0px; 158 | } 159 | 160 | /* Text inputs */ 161 | .textinput,.textinputHovered { 162 | height: 30px; 163 | /*background: url(images/input_bg.gif) repeat-x left top;*/ 164 | border: solid 2px #DAE4E8; 165 | padding: 4px 0; 166 | vertical-align: middle; 167 | text-indent: 5px; 168 | width: 500px; 169 | } 170 | 171 | .textInputSelected { 172 | border: solid 2px #0099CC; 173 | } 174 | 175 | .textinputHovered { 176 | background-position: left bottom; 177 | color: #0099CC; 178 | border-width: 2px; 179 | height: 30px; 180 | } 181 | 182 | input[type="text"]:hover { 183 | border: solid 2px #0099CC; 184 | } 185 | 186 | .inputCorner { 187 | padding-bottom: 0; 188 | vertical-align: middle; 189 | } 190 | 191 | h1.section { 192 | color: #0099CC; 193 | font-size: 1.6em; 194 | } 195 | 196 | /* Button */ 197 | .buttonSubmit, .buttonSubmitHovered { 198 | width: auto; 199 | height: 45px; 200 | color: #FFF; 201 | font-weight: bold; 202 | } 203 | 204 | .buttonSubmitHovered { 205 | background-position: left bottom; 206 | } 207 | 208 | .buttonImg { 209 | vertical-align: bottom; 210 | } 211 | 212 | input[type="submit"].buttonSubmit { 213 | margin: 10px; 214 | margin-left: 0px; 215 | } 216 | 217 | input[type="submit"]:hover { 218 | background-position: left bottom; 219 | cursor: pointer; 220 | border: solid 2px #0099CC; 221 | } 222 | 223 | #symbolCheckerDiv { 224 | height: 350px; 225 | } 226 | 227 | .divLeft { 228 | float: left; 229 | width: 40%; 230 | } 231 | .divRight { 232 | float: right; 233 | padding-top: 100px; 234 | width: 60%; 235 | text-align: center; 236 | } 237 | 238 | input.watermark { 239 | color: #999; 240 | font-weight: bold; 241 | } 242 | 243 | .space { 244 | height: 20px; 245 | } 246 | 247 | .pingResult { 248 | float:right; 249 | margin: 25px 650px auto auto; 250 | text-shadow: 0px 2px 3px #555; 251 | } 252 | 253 | .success { 254 | color: #00CD00; 255 | } 256 | .failure { 257 | color: #CD2626; 258 | } -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/js/skin-vista/icons.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/service/mil-sym-service/src/main/webapp/js/skin-vista/icons.gif -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/js/skin-vista/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/service/mil-sym-service/src/main/webapp/js/skin-vista/loading.gif -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/js/skin/icons.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/service/mil-sym-service/src/main/webapp/js/skin/icons.gif -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/js/skin/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/service/mil-sym-service/src/main/webapp/js/skin/loading.gif -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/js/skin/vline.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/missioncommand/old-mil-sym-java/98382d0a471c50b18a46fe04669a747f7925f075/service/mil-sym-service/src/main/webapp/js/skin/vline.gif -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/rpc_relay.uncompressed.html: -------------------------------------------------------------------------------- 1 | 17 | -------------------------------------------------------------------------------- /service/mil-sym-service/src/main/webapp/symbology-renderer-widget.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Extensible Symbology Renderer Widget 5 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
Mil Symbology Renderer Widget
24 |
25 |
This widget renders MIL-STD-2525 Symbology for maps. Please minimize, but do not close.
26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /service/mil-sym-service/src/test/java/test/sec/web/renderer/imaging/SpringImagingTests.java: -------------------------------------------------------------------------------- 1 | package test.sec.web.renderer.imaging; 2 | 3 | import static org.junit.Assert.*; 4 | 5 | import java.io.IOException; 6 | import java.net.MalformedURLException; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | //import org.springframework.test.context.ContextConfiguration; 11 | //import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 12 | import org.springframework.web.client.RestTemplate; 13 | import org.xml.sax.SAXException; 14 | 15 | import sec.web.renderer.services.imaging.ImageGeneratorController; 16 | 17 | import com.meterware.httpunit.GetMethodWebRequest; 18 | import com.meterware.httpunit.WebRequest; 19 | import com.meterware.httpunit.WebResponse; 20 | import com.meterware.servletunit.ServletRunner; 21 | import com.meterware.servletunit.ServletUnitClient; 22 | 23 | 24 | //@RunWith(SpringJUnit4ClassRunner.class) 25 | //@ContextConfiguration( locations = { "test-dispatch-servlet.xml" }) 26 | @SuppressWarnings("unused") 27 | public class SpringImagingTests { 28 | 29 | private String BASE_URL = "http://localhost:8080/rendering-sdk/renderer"; 30 | private String KML_URL = "/kml/SFGP-----------"; // ?name=testKML&description=globeView&lat=-39&lon=-78&alt=25000&id=test1 31 | private String IMG_URL = "/image/SFGP-----------"; // ?T=uniquedesignation&n=ENY&h=USA" 32 | 33 | 34 | // @Test 35 | // public void testMe() { 36 | // RestTemplate rest = new RestTemplate(); 37 | // 38 | // rest.getForObject(BASE_URL, new Object[]{}); 39 | // } 40 | 41 | // @Test 42 | // public void getImagingKMLTest() throws MalformedURLException, IOException, SAXException { 43 | // ServletRunner sr = new ServletRunner(); 44 | // sr.registerServlet("ImageGeneratorController", ImageGeneratorController.class.getName()); 45 | // 46 | // ServletUnitClient client = sr.newClient(); 47 | // WebRequest request = new GetMethodWebRequest(BASE_URL+KML_URL); 48 | // request.setParameter("name", "unique designation"); 49 | // request.setParameter("description", "additional info"); 50 | // request.setParameter("lat", "-39"); 51 | // request.setParameter("lon", "-78"); 52 | // request.setParameter("alt", "25000"); 53 | // 54 | // WebResponse response = sr.getResponse(request); 55 | // WebResponse resp = client.getResponse(request); 56 | // 57 | // assertNotNull("no response received", response); 58 | // assertNotNull("no response received", resp); 59 | // 60 | // String content = response.getText(); 61 | // System.out.println(content); 62 | // 63 | // assertTrue(content, content.contains("name")); 64 | // } 65 | 66 | 67 | // 68 | // @Test 69 | // public void getImagingImageTest() throws MalformedURLException, IOException, SAXException { 70 | // ServletRunner sr = new ServletRunner(); 71 | // sr.registerServlet("ImageGeneratorController", ImageGeneratorController.class.getName()); 72 | // 73 | // ServletUnitClient client = sr.newClient(); 74 | // WebRequest request = new GetMethodWebRequest(BASE_URL+IMG_URL); 75 | // request.setParameter("name", "unique designation"); 76 | // request.setParameter("description", "additional info"); 77 | // request.setParameter("lat", "-39"); 78 | // request.setParameter("lon", "-78"); 79 | // request.setParameter("alt", "25000"); 80 | // 81 | // WebResponse response = sr.getResponse(request); 82 | // WebResponse resp = client.getResponse(request); 83 | // 84 | // assertNotNull("no response received", response); 85 | // assertNotNull("no response received", resp); 86 | // 87 | // String content = response.getText(); 88 | // System.out.println(content); 89 | // 90 | // assertTrue(content, content.contains("name")); 91 | // } 92 | 93 | // @Test 94 | // public void testUtilsPNG() { 95 | // String url = "/ImageGeneratorController/image/123456789012345"; 96 | // String queryStr = "t=unique+designation&h=additional+info&n=ENY"; 97 | // byte[] pngResp = ImagingUtils.getMilStd2525Png(url, queryStr); 98 | // } 99 | 100 | } 101 | -------------------------------------------------------------------------------- /service/mil-sym-service/src/test/java/test/sec/web/renderer/imaging/TestImagingUtils.java: -------------------------------------------------------------------------------- 1 | package test.sec.web.renderer.imaging; 2 | 3 | import static org.junit.Assert.*; 4 | import java.io.IOException; 5 | import java.net.MalformedURLException; 6 | 7 | import org.junit.AfterClass; 8 | import org.junit.BeforeClass; 9 | import org.junit.Test; 10 | import org.xml.sax.SAXException; 11 | 12 | import sec.web.renderer.services.imaging.ImageGeneratorServlet; 13 | import sec.web.renderer.utils.ImagingUtils; 14 | 15 | import com.meterware.httpunit.GetMethodWebRequest; 16 | import com.meterware.httpunit.WebRequest; 17 | import com.meterware.httpunit.WebResponse; 18 | import com.meterware.servletunit.ServletRunner; 19 | import com.meterware.servletunit.ServletUnitClient; 20 | 21 | @SuppressWarnings("unused") 22 | public class TestImagingUtils { 23 | 24 | protected static ImagingUtils utils = null; 25 | protected String servletURL = "http://test.meterware.com/ImageGeneratorServlet"; 26 | 27 | @BeforeClass 28 | public static void init() { 29 | utils = new ImagingUtils(); 30 | } 31 | 32 | @AfterClass 33 | public static void destroy() throws IOException { 34 | 35 | } 36 | 37 | // @Test 38 | // public void getAllQueryParamsTest() throws MalformedURLException, IOException, SAXException { 39 | // ServletRunner sr = new ServletRunner(); 40 | // sr.registerServlet("ImageGeneratorServlet", ImageGeneratorServlet.class.getName()); 41 | // 42 | // ServletUnitClient client = sr.newClient(); 43 | // WebRequest request = new GetMethodWebRequest(servletURL); 44 | // request.setParameter("t", "unique designation"); 45 | // request.setParameter("h", "additional info"); 46 | // request.setParameter("n", "ENY"); 47 | // 48 | // WebResponse response = sr.getResponse(request); 49 | // 50 | // assertNotNull("no response received", response); 51 | // 52 | // String content = response.getText(); 53 | // System.out.println(content); 54 | // 55 | // assertTrue(content, content.contains("param2")); 56 | // } 57 | 58 | 59 | // @Test 60 | // public void testUtilsPNG() { 61 | // String url = "/ImageGeneratorServlet/image/123456789012345"; 62 | // String queryStr = "t=unique+designation&h=additional+info&n=ENY"; 63 | // byte[] pngResp = ImagingUtils.getMilStd2525Png(url, queryStr); 64 | // } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /service/mil-sym-service/src/test/java/test/sec/web/renderer/imaging/test-dispatch-servlet.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /service/mil-sym-service/src/test/resources/test-dispatch-servlet.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /service/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | io.github.missioncommand 6 | mil-sym-java 7 | 0.1.43 8 | .. 9 | 10 | 11 | mil-sym-service-parent 12 | pom 13 | mil-sym-java :: Service 14 | mil-sym-java Service 15 | 16 | 17 | mil-sym-service 18 | 19 | 20 | 21 | 22 | 23 | org.apache.maven.plugins 24 | maven-source-plugin 25 | 26 | 27 | attach-sources 28 | 29 | jar 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /travis/release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set +x 4 | set -e 5 | 6 | echo '[release] TRAVIS_TAG='$TRAVIS_TAG 7 | echo '[release] TRAVIS_PULL_REQUEST='$TRAVIS_PULL_REQUEST 8 | 9 | # we only publish if a tag, but not NOT PRs 10 | if [[ -n $TRAVIS_TAG ]] && [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then 11 | mvn -Pinclude-sources -Pinclude-javadocs deploy --settings travis/settings.xml -DskipTests=true -e 12 | exit $? 13 | fi 14 | -------------------------------------------------------------------------------- /travis/settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | bintray-missioncommand-maven 5 | ${env.BINTRAY_USER} 6 | ${env.BINTRAY_KEY} 7 | 8 | 9 | --------------------------------------------------------------------------------