├── src ├── main │ ├── resources │ │ └── com │ │ │ └── wymarc │ │ │ └── astrolabe │ │ │ └── generator │ │ │ ├── gui │ │ │ └── images │ │ │ │ ├── logo.png │ │ │ │ ├── back │ │ │ │ ├── eot.png │ │ │ │ ├── cotan.png │ │ │ │ ├── arc_proj.png │ │ │ │ ├── b_l_horz.png │ │ │ │ ├── b_r_horz.png │ │ │ │ ├── backlimb.png │ │ │ │ ├── location.png │ │ │ │ ├── offset.png │ │ │ │ ├── t_l_arcs.png │ │ │ │ ├── t_l_sine.png │ │ │ │ ├── arc_equal.png │ │ │ │ ├── b_l_cotan.png │ │ │ │ ├── b_l_shadow.png │ │ │ │ ├── b_r_cotan.png │ │ │ │ ├── b_r_shadow.png │ │ │ │ ├── backlimbZ.png │ │ │ │ ├── concentric.png │ │ │ │ ├── correction.png │ │ │ │ ├── t_l_cos100.png │ │ │ │ ├── t_l_cosine.png │ │ │ │ ├── both_unequal.png │ │ │ │ ├── t_l_cosdegree.png │ │ │ │ ├── t_l_obliqity.png │ │ │ │ ├── t_l_radials.png │ │ │ │ ├── t_l_sine100.png │ │ │ │ ├── t_l_unequal.png │ │ │ │ ├── t_r_unequal.png │ │ │ │ ├── lunar_mansions.png │ │ │ │ └── t_l_sinedegree.png │ │ │ │ ├── misc │ │ │ │ ├── reg.png │ │ │ │ ├── octagon.png │ │ │ │ ├── throne.png │ │ │ │ ├── throne2.png │ │ │ │ ├── rulesthumb.png │ │ │ │ ├── universal.png │ │ │ │ ├── rete_classic.png │ │ │ │ ├── rete_classicZ.png │ │ │ │ └── rete_modern.png │ │ │ │ ├── front │ │ │ │ ├── 1degree.png │ │ │ │ ├── 2degree.png │ │ │ │ ├── 5degree.png │ │ │ │ ├── alpha_d.png │ │ │ │ ├── alpha_h.png │ │ │ │ ├── azimuth.png │ │ │ │ ├── front.png │ │ │ │ ├── houses.png │ │ │ │ ├── roman_d.png │ │ │ │ ├── roman_h.png │ │ │ │ ├── 10degree.png │ │ │ │ ├── arabic_d.png │ │ │ │ ├── arabic_h.png │ │ │ │ ├── horizons.png │ │ │ │ ├── nauticum.png │ │ │ │ ├── twilight.png │ │ │ │ ├── alltwilight.png │ │ │ │ └── unequalfront.png │ │ │ │ ├── icons │ │ │ │ ├── Print16.gif │ │ │ │ ├── Print24.gif │ │ │ │ ├── Save16.gif │ │ │ │ ├── Save24.gif │ │ │ │ ├── SaveAs16.gif │ │ │ │ ├── SaveAs24.gif │ │ │ │ ├── PageSetup16.gif │ │ │ │ ├── PageSetup24.gif │ │ │ │ ├── SaveAsZip24.gif │ │ │ │ ├── PrintPreview16.gif │ │ │ │ └── PrintPreview24.gif │ │ │ │ └── quadrants │ │ │ │ ├── simplehorary.png │ │ │ │ ├── sinequadrant.png │ │ │ │ ├── advancedhorary.png │ │ │ │ ├── colorsinequadrant.png │ │ │ │ ├── equalhourshorary.png │ │ │ │ └── advancedsinequadrant.png │ │ │ ├── reference │ │ │ └── Astrolabe_assembly.pdf │ │ │ └── astrolabe_config.xml │ └── java │ │ └── com │ │ └── wymarc │ │ └── astrolabe │ │ ├── generator │ │ ├── gui │ │ │ ├── FocusGrabber.java │ │ │ ├── ExitAction.java │ │ │ ├── tabbedview │ │ │ │ ├── GeneratorTabbedPane.java │ │ │ │ ├── RetePanel.java │ │ │ │ ├── AstrolabeVariationsPanel.java │ │ │ │ ├── ExtrasPanel.java │ │ │ │ └── QuadrantPanel.java │ │ │ ├── GeneratorMenuBar.java │ │ │ ├── dialogs │ │ │ │ ├── HelpDialog.java │ │ │ │ ├── ResourcesDialog.java │ │ │ │ └── AboutDialog.java │ │ │ ├── GeneratorToolBar.java │ │ │ └── GeneratorGui.java │ │ ├── config │ │ │ ├── ClimatePlate.java │ │ │ ├── ClimateSet.java │ │ │ ├── AstrolabeExample.java │ │ │ └── Config.java │ │ ├── AstrolabeGenerator.java │ │ ├── printengines │ │ │ └── postscript │ │ │ │ ├── extras │ │ │ │ ├── DemoArms.java │ │ │ │ ├── Dastur.java │ │ │ │ └── horary │ │ │ │ │ └── BasicHoraryQuadrant.java │ │ │ │ └── SineGrid.java │ │ └── io │ │ │ └── FileHandler.java │ │ ├── math │ │ ├── ThreePointCenter.java │ │ └── InterSect.java │ │ ├── Star.java │ │ └── Location.java └── test │ └── java │ └── com │ └── wymarc │ └── astrolabe │ ├── generator │ └── AppTest.java │ └── math │ ├── AstroMathTest.java │ ├── ThreePointCenterTest.java │ └── InterSectTest.java ├── .gitignore ├── README.md └── pom.xml /src/main/resources/com/wymarc/astrolabe/generator/gui/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/logo.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/eot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/eot.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/misc/reg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/misc/reg.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/cotan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/cotan.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/arc_proj.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/arc_proj.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/b_l_horz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/b_l_horz.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/b_r_horz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/b_r_horz.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/backlimb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/backlimb.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/location.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/offset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/offset.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/t_l_arcs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/t_l_arcs.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/t_l_sine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/t_l_sine.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/1degree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/1degree.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/2degree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/2degree.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/5degree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/5degree.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/alpha_d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/alpha_d.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/alpha_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/alpha_h.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/azimuth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/azimuth.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/front.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/front.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/houses.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/houses.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/roman_d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/roman_d.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/roman_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/roman_h.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/icons/Print16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/icons/Print16.gif -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/icons/Print24.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/icons/Print24.gif -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/icons/Save16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/icons/Save16.gif -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/icons/Save24.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/icons/Save24.gif -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/misc/octagon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/misc/octagon.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/misc/throne.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/misc/throne.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/misc/throne2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/misc/throne2.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/arc_equal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/arc_equal.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/b_l_cotan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/b_l_cotan.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/b_l_shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/b_l_shadow.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/b_r_cotan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/b_r_cotan.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/b_r_shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/b_r_shadow.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/backlimbZ.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/backlimbZ.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/concentric.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/concentric.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/correction.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/correction.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/t_l_cos100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/t_l_cos100.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/t_l_cosine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/t_l_cosine.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/10degree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/10degree.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/arabic_d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/arabic_d.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/arabic_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/arabic_h.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/horizons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/horizons.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/nauticum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/nauticum.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/twilight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/twilight.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/icons/SaveAs16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/icons/SaveAs16.gif -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/icons/SaveAs24.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/icons/SaveAs24.gif -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/misc/rulesthumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/misc/rulesthumb.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/misc/universal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/misc/universal.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/both_unequal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/both_unequal.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/t_l_cosdegree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/t_l_cosdegree.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/t_l_obliqity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/t_l_obliqity.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/t_l_radials.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/t_l_radials.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/t_l_sine100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/t_l_sine100.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/t_l_unequal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/t_l_unequal.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/t_r_unequal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/t_r_unequal.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/alltwilight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/alltwilight.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/unequalfront.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/front/unequalfront.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/icons/PageSetup16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/icons/PageSetup16.gif -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/icons/PageSetup24.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/icons/PageSetup24.gif -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/icons/SaveAsZip24.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/icons/SaveAsZip24.gif -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/misc/rete_classic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/misc/rete_classic.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/misc/rete_classicZ.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/misc/rete_classicZ.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/misc/rete_modern.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/misc/rete_modern.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/reference/Astrolabe_assembly.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/reference/Astrolabe_assembly.pdf -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/lunar_mansions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/lunar_mansions.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/t_l_sinedegree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/back/t_l_sinedegree.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/icons/PrintPreview16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/icons/PrintPreview16.gif -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/icons/PrintPreview24.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/icons/PrintPreview24.gif -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/quadrants/simplehorary.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/quadrants/simplehorary.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/quadrants/sinequadrant.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/quadrants/sinequadrant.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/quadrants/advancedhorary.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/quadrants/advancedhorary.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/quadrants/colorsinequadrant.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/quadrants/colorsinequadrant.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/quadrants/equalhourshorary.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/quadrants/equalhourshorary.png -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/gui/images/quadrants/advancedsinequadrant.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wymarc/astrolabe-generator/HEAD/src/main/resources/com/wymarc/astrolabe/generator/gui/images/quadrants/advancedsinequadrant.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Maven files 2 | target 3 | 4 | #Idea files 5 | .idea 6 | *.iml 7 | 8 | 9 | # Compiled class file 10 | *.class 11 | 12 | # Log file 13 | *.log 14 | 15 | # BlueJ files 16 | *.ctxt 17 | 18 | # Mobile Tools for Java (J2ME) 19 | .mtj.tmp/ 20 | 21 | # Package Files # 22 | *.jar 23 | *.war 24 | *.ear 25 | *.zip 26 | *.tar.gz 27 | *.rar 28 | 29 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 30 | hs_err_pid* 31 | -------------------------------------------------------------------------------- /src/test/java/com/wymarc/astrolabe/generator/AppTest.java: -------------------------------------------------------------------------------- 1 | package com.wymarc.astrolabe.generator; 2 | 3 | import junit.framework.Test; 4 | import junit.framework.TestCase; 5 | import junit.framework.TestSuite; 6 | 7 | /** 8 | * Unit test for simple App. 9 | */ 10 | public class AppTest 11 | extends TestCase 12 | { 13 | /** 14 | * Create the test case 15 | * 16 | * @param testName name of the test case 17 | */ 18 | public AppTest( String testName ) 19 | { 20 | super( testName ); 21 | } 22 | 23 | /** 24 | * @return the suite of tests being tested 25 | */ 26 | public static Test suite() 27 | { 28 | return new TestSuite( AppTest.class ); 29 | } 30 | 31 | /** 32 | * Rigourous Test :-) 33 | */ 34 | public void testApp() 35 | { 36 | assertTrue( true ); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/test/java/com/wymarc/astrolabe/math/AstroMathTest.java: -------------------------------------------------------------------------------- 1 | package com.wymarc.astrolabe.math; 2 | 3 | /** 4 | * Created with IntelliJ IDEA. 5 | * User: tim.mitchell 6 | * Date: 4/2/13 7 | * Time: 6:58 AM 8 | * To change this template use File | Settings | File Templates. 9 | */ 10 | 11 | import junit.framework.TestCase; 12 | 13 | public class AstroMathTest extends TestCase { 14 | public void testNormal() throws Exception { 15 | assertEquals("377 normalizes to 17", 17.0, AstroMath.normal(377.0)); 16 | assertEquals("-377 normalizes to 343", 343.0, AstroMath.normal(-377.0)); 17 | assertEquals("270 normalizes to 270", 270.0, AstroMath.normal(270.0)); 18 | } 19 | 20 | public void testIntegerPart() throws Exception { 21 | assertEquals("377.0 returns 377.0", 377.0, AstroMath.integerPart(377.0)); 22 | assertEquals("481.43 normalizes to 481", 481.0, AstroMath.integerPart(481.43)); 23 | assertEquals("481.53 normalizes to 481", 481.0, AstroMath.integerPart(481.53)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/wymarc/astrolabe/generator/gui/FocusGrabber.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: AstrolabeGenerator.java,v 3.1 3 | *

4 | * The Astrolabe Generator is free software; you can redistribute it 5 | * and/or modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 3 of 7 | * the License, or(at your option) any later version. 8 | *

9 | * The Astrolabe Generator is distributed in the hope that it will be 10 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 11 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | *

14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *

18 | * Copyright (c) 2017 Timothy J. Mitchell 19 | */ 20 | package com.wymarc.astrolabe.generator.gui; 21 | 22 | import javax.swing.*; 23 | 24 | public class FocusGrabber implements Runnable { 25 | private JComponent component; 26 | 27 | public FocusGrabber(JComponent component) { 28 | this.component = component; 29 | } 30 | 31 | public void run() { 32 | component.grabFocus(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/wymarc/astrolabe/generator/config/ClimatePlate.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: AstrolabeGenerator.java,v 3.1 3 | *

4 | * The Astrolabe Generator is free software; you can redistribute it 5 | * and/or modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 3 of 7 | * the License, or(at your option) any later version. 8 | *

9 | * The Astrolabe Generator is distributed in the hope that it will be 10 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 11 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | *

14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *

18 | * Copyright (c) 2017 Timothy J. Mitchell 19 | */ 20 | package com.wymarc.astrolabe.generator.config; 21 | 22 | public class ClimatePlate { 23 | private String name; 24 | private String location; 25 | 26 | public String getName() { 27 | return name; 28 | } 29 | 30 | public void setName(String name) { 31 | this.name = name; 32 | } 33 | 34 | public String getLocation() { 35 | return location; 36 | } 37 | 38 | public void setLocation(String location) { 39 | this.location = location; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/wymarc/astrolabe/generator/AstrolabeGenerator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: AstrolabeGenerator.java,v 3.1 3 | *

4 | * The Astrolabe Generator is free software; you can redistribute it 5 | * and/or modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 3 of 7 | * the License, or(at your option) any later version. 8 | *

9 | * The Astrolabe Generator is distributed in the hope that it will be 10 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 11 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | *

14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *

18 | * Copyright (c) 2017 Timothy J. Mitchell 19 | */ 20 | package com.wymarc.astrolabe.generator; 21 | 22 | import com.wymarc.astrolabe.generator.gui.GeneratorGui; 23 | 24 | public class AstrolabeGenerator{ 25 | 26 | public AstrolabeGenerator(){ 27 | GeneratorGui gui = new GeneratorGui(); 28 | } 29 | 30 | 31 | public static void main(String[] args) { 32 | javax.swing.SwingUtilities.invokeLater(new Runnable() { 33 | public void run() { 34 | new AstrolabeGenerator(); 35 | } 36 | }); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/test/java/com/wymarc/astrolabe/math/ThreePointCenterTest.java: -------------------------------------------------------------------------------- 1 | package com.wymarc.astrolabe.math; 2 | 3 | import junit.framework.TestCase; 4 | 5 | import java.awt.geom.Point2D; 6 | 7 | /** 8 | * Astrolabe Generator 9 | *

10 | * The Astrolabe Generator is free software; you can redistribute it 11 | * and/or modify it under the terms of the GNU General Public License 12 | * as published by the Free Software Foundation; either version 2 of 13 | * the License, or(at your option) any later version. 14 | *

15 | * The Astrolabe Generator is distributed in the hope that it will be 16 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 17 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | *

20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 23 | *

24 | * Copyright (c) 2013 Timothy J. Mitchell 25 | * 26 | * @author Timothy J. Mitchell (aka Richard Wymarc) 27 | * @version 4.0 28 | */ 29 | public class ThreePointCenterTest extends TestCase { 30 | 31 | ThreePointCenter test; 32 | 33 | public void setUp() throws Exception { 34 | super.setUp(); 35 | Point2D.Double linePoint1 = new Point2D.Double(-10.0,0.0); 36 | Point2D.Double linePoint2 = new Point2D.Double(0.0,0.0); 37 | Point2D.Double linePoint3 = new Point2D.Double(10.0,0.0); 38 | 39 | test = new ThreePointCenter(linePoint1,linePoint2,linePoint3); 40 | } 41 | 42 | public void testGetCenter() throws Exception { 43 | 44 | } 45 | 46 | public void testGetRadius() throws Exception { 47 | 48 | } 49 | 50 | public void testIsCircle() throws Exception { 51 | assertTrue(!test.isCircle()); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/wymarc/astrolabe/generator/config/ClimateSet.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: AstrolabeGenerator.java,v 3.1 3 | *

4 | * The Astrolabe Generator is free software; you can redistribute it 5 | * and/or modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 3 of 7 | * the License, or(at your option) any later version. 8 | *

9 | * The Astrolabe Generator is distributed in the hope that it will be 10 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 11 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | *

14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *

18 | * Copyright (c) 2017 Timothy J. Mitchell 19 | */ 20 | package com.wymarc.astrolabe.generator.config; 21 | 22 | import java.util.ArrayList; 23 | import java.util.List; 24 | 25 | public class ClimateSet { 26 | private String name = ""; 27 | private List climates; 28 | 29 | public ClimateSet() { 30 | climates = new ArrayList<>(); 31 | } 32 | 33 | public String getLocationNames(){ 34 | String result = ""; 35 | for (ClimatePlate plate : climates){ 36 | if (result.equals("")){ 37 | result = plate.getName(); 38 | }else{ 39 | result = result + ", " + plate.getName(); 40 | } 41 | } 42 | return result; 43 | } 44 | 45 | public String getName() { 46 | return name; 47 | } 48 | 49 | public void setName(String name) { 50 | this.name = name; 51 | } 52 | 53 | public void addClimate(ClimatePlate plate){ 54 | climates.add(plate); 55 | } 56 | 57 | public List getClimates(){ 58 | return climates; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/test/java/com/wymarc/astrolabe/math/InterSectTest.java: -------------------------------------------------------------------------------- 1 | package com.wymarc.astrolabe.math; 2 | 3 | import junit.framework.TestCase; 4 | 5 | /** 6 | * Astrolabe Generator 7 | *

8 | * The Astrolabe Generator is free software; you can redistribute it 9 | * and/or modify it under the terms of the GNU General Public License 10 | * as published by the Free Software Foundation; either version 2 of 11 | * the License, or(at your option) any later version. 12 | *

13 | * The Astrolabe Generator is distributed in the hope that it will be 14 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 15 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | *

18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | *

22 | * Copyright (c) 2013 Timothy J. Mitchell 23 | * 24 | * @author Timothy J. Mitchell (aka Richard Wymarc) 25 | * @version 4.0 26 | */ 27 | public class InterSectTest extends TestCase { 28 | 29 | InterSect test = new InterSect(0.0,0.0,10.0,10.0,0.0,10.0); // intersects 30 | InterSect test1 = new InterSect(0.0,0.0,10.0,25.0,0.0,10.0); // no intersection 31 | 32 | public void testGetXi() throws Exception { 33 | 34 | } 35 | 36 | public void testGetYi() throws Exception { 37 | 38 | } 39 | 40 | public void testGetXi_prime() throws Exception { 41 | 42 | } 43 | 44 | public void testGetYi_prime() throws Exception { 45 | 46 | } 47 | 48 | public void testGetAngle1() throws Exception { 49 | 50 | } 51 | 52 | public void testGetAngle2() throws Exception { 53 | 54 | } 55 | 56 | public void testGetIntersection() throws Exception { 57 | if (test.getIntersection() && !test1.getIntersection()){ 58 | assertTrue(true); 59 | }else{ 60 | assertTrue(false); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/wymarc/astrolabe/generator/gui/ExitAction.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: AstrolabeGenerator.java,v 3.1 3 | *

4 | * The Astrolabe Generator is free software; you can redistribute it 5 | * and/or modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 3 of 7 | * the License, or(at your option) any later version. 8 | *

9 | * The Astrolabe Generator is distributed in the hope that it will be 10 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 11 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | *

14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *

18 | * Copyright (c) 2017 Timothy J. Mitchell 19 | */ 20 | package com.wymarc.astrolabe.generator.gui; 21 | 22 | import java.awt.Frame; 23 | import java.awt.event.ActionEvent; 24 | import java.awt.event.KeyEvent; 25 | import java.awt.event.WindowEvent; 26 | import javax.swing.Action; 27 | import javax.swing.AbstractAction; 28 | 29 | /** 30 | * This class will create and dispatch a WINDOW_CLOSING event to the active 31 | * frame. As a result a request to close the frame will be made and any 32 | * WindowListener that handles the windowClosing event will be executed. 33 | * Since clicking on the "Close" button of the frame or selecting the "Close" 34 | * option from the system menu also invoke the WindowListener, this will 35 | * provide a common exit point for the application. 36 | */ 37 | public class ExitAction extends AbstractAction 38 | { 39 | public ExitAction() 40 | { 41 | super("Exit"); 42 | putValue( Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_X) ); 43 | } 44 | 45 | public void actionPerformed(ActionEvent e) 46 | { 47 | // Find the active frame before creating and dispatching the event 48 | 49 | for (Frame frame : Frame.getFrames()) 50 | { 51 | if (frame.isActive()) 52 | { 53 | WindowEvent windowClosing = new WindowEvent(frame, WindowEvent.WINDOW_CLOSING); 54 | frame.dispatchEvent(windowClosing); 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # The Astrolabe Generator 2 | A Java-based tool for generating EPS files for constructing astrolabes and related tools 3 | 4 | In support of my ongoing research project into medieval scientific instruments such as the astrolabe, I have created a tool to allow the design of custom astrolabes. 5 | 6 | ## Features: 7 | 8 | - Allows customization of the astrolabe with a wide variety of options. 9 | - Additional related instruments are available: 10 | - The Universal Astrolabe. 11 | - The Sine Quadrant. 12 | - The Horary Quadrant. 13 | - Java based (executable .jar). 14 | - Generates Encapsulated PostScript (eps) files. 15 | - Saves to zip or folder. 16 | - Prints to PostScript capable printers. 17 | 18 | ## Related projects: 19 | 20 | [HTML5 Simulators](https://github.com/wymarc/html5-simulators): Simulations of the astrolabe and sine quadrant. 21 | 22 | For more information visit: 23 | 24 | [The Astrolabe Project](http://www.astrolabeproject.com/) 25 | 26 | ![image](http://www.astrolabeproject.com/wp-content/uploads/2017/09/version3.png) 27 | 28 | ## Release History: 29 | 30 | 3.3: 31 | 32 | - Fixed bug in Arcs of the Signs. Both options now work. 33 | - Expanded options for the sine/cosine grid scale on the astrolabe back: 34 | - Grid divided by 60 or 100 35 | - Optional cosine lines 36 | - Arcs and radials 37 | - Lines for each degree option 38 | - Under the hood: 39 | - Version number displays in interface now pulled dynamically from pom.xml 40 | - Default folder for saving is now the folder the app was run from 41 | - Consolidated file handling in the FileHandler class 42 | - Updated to Java 1.8 43 | 44 | 3.2: 45 | 46 | - Fixed bug in the formatting of shadow square numbers 47 | - Added in an option to display all three twilight lines 48 | - Added the option of using a concentric calendar ring instead of the more common offset 49 | - Added the option to choose between a base 60 and the less used base 10 grid for the sine scale on the back 50 | 51 | 3.1: 52 | 53 | - Added Universal Astrolabe with optional rete 54 | - Added an optional Equation of Time scale to the back 55 | - Under the hood: 56 | - Added routine for right-justifying text 57 | - Fixed bug in Time Correction display 58 | 59 | 3.0: 60 | 61 | - Ported project back to Java 62 | - Moved source code to GITHUB 63 | 64 | -------------------------------------------------------------------------------- /src/main/java/com/wymarc/astrolabe/generator/gui/tabbedview/GeneratorTabbedPane.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: AstrolabeGenerator.java,v 3.1 3 | *

4 | * The Astrolabe Generator is free software; you can redistribute it 5 | * and/or modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 3 of 7 | * the License, or(at your option) any later version. 8 | *

9 | * The Astrolabe Generator is distributed in the hope that it will be 10 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 11 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | *

14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *

18 | * Copyright (c) 2017 Timothy J. Mitchell 19 | */ 20 | package com.wymarc.astrolabe.generator.gui.tabbedview; 21 | 22 | import javax.swing.*; 23 | 24 | public class GeneratorTabbedPane extends JTabbedPane { 25 | private FrontPanel frontPanel; 26 | private BackPanel backPanel; 27 | private RetePanel retePanel; 28 | private AstrolabeVariationsPanel astrolabeVariationsPanel; 29 | private ExtrasPanel extrasPanel; 30 | private QuadrantPanel quadrantPanel; 31 | 32 | public GeneratorTabbedPane(){ 33 | super(); 34 | addTab("Front", null, getFrontPanel(), "Front options"); 35 | addTab("Back", null, getBackPanel(), "Back options"); 36 | addTab("Rete and Rules", null, getRetePanel(), "Rete and Rules options"); 37 | addTab("Astrolabe Variations", null, getAstrolabeVariationsPanel(), "Astrolabe Variations"); 38 | addTab("Quadrants", null, getQuadrantPanel(), "Quadrants options"); 39 | addTab("Extras", null, getExtrasPanel(), "Extras to add"); 40 | } 41 | 42 | public FrontPanel getFrontPanel() { 43 | if(null == frontPanel){ 44 | frontPanel = new FrontPanel(); 45 | } 46 | return frontPanel; 47 | } 48 | 49 | public BackPanel getBackPanel() { 50 | if(null == backPanel){ 51 | backPanel = new BackPanel(); 52 | } 53 | return backPanel; 54 | } 55 | 56 | public RetePanel getRetePanel() { 57 | if(null == retePanel){ 58 | retePanel = new RetePanel(); 59 | } 60 | return retePanel; 61 | } 62 | 63 | public AstrolabeVariationsPanel getAstrolabeVariationsPanel() { 64 | if(null == astrolabeVariationsPanel){ 65 | astrolabeVariationsPanel = new AstrolabeVariationsPanel(); 66 | } 67 | return astrolabeVariationsPanel; 68 | } 69 | 70 | public ExtrasPanel getExtrasPanel() { 71 | if(null == extrasPanel){ 72 | extrasPanel = new ExtrasPanel(); 73 | } 74 | return extrasPanel; 75 | } 76 | 77 | public QuadrantPanel getQuadrantPanel() { 78 | if(null == quadrantPanel){ 79 | quadrantPanel = new QuadrantPanel(); 80 | } 81 | return quadrantPanel; 82 | } 83 | 84 | public void updateControls(){ 85 | //todo 86 | frontPanel.updateControls(); 87 | backPanel.updateControls(); 88 | retePanel.updateControls(); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | com.wymarc.astrolabe.generator 5 | AstrolabeGenerator 6 | jar 7 | 3.3 8 | AstrolabeGenerator 9 | http://maven.apache.org 10 | 11 | UTF-8 12 | 1.8 13 | 1.8 14 | 15 | 16 | 17 | junit 18 | junit 19 | 3.8.1 20 | test 21 | 22 | 23 | 24 | 25 | Windows Environment 26 | 27 | 28 | windows 29 | 30 | 31 | 32 | 33 | 34 | src/main/resources 35 | true 36 | 37 | 38 | 39 | 40 | org.apache.maven.plugins 41 | maven-compiler-plugin 42 | 2.3.2 43 | 44 | 1.8 45 | 1.8 46 | 47 | 48 | 49 | org.apache.maven.plugins 50 | maven-jar-plugin 51 | 2.3.2 52 | 53 | 54 | 55 | com.wymarc.astrolabe.generator.AstrolabeGenerator 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | Linux Environment 65 | 66 | 67 | !windows 68 | 69 | 70 | 71 | 72 | 73 | src/main/resources 74 | true 75 | 76 | 77 | 78 | 79 | org.apache.maven.plugins 80 | maven-compiler-plugin 81 | 2.3.2 82 | 83 | 1.5 84 | 1.5 85 | 86 | 87 | 88 | org.apache.maven.plugins 89 | maven-jar-plugin 90 | 2.3.2 91 | 92 | 93 | 94 | com.wymarc.astrolabe.generator.AstrolabeGenerator 95 | 96 | 97 | 98 | 99 | 100 | org.codehaus.mojo 101 | exec-maven-plugin 102 | 1.3.2 103 | 104 | 105 | script-chmod 106 | install 107 | 108 | exec 109 | 110 | 111 | chmod 112 | 113 | +x 114 | ${project.basedir}/target/${project.artifactId}-${project.version}.jar 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /src/main/java/com/wymarc/astrolabe/generator/gui/tabbedview/RetePanel.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: AstrolabeGenerator.java,v 3.1 3 | *

4 | * The Astrolabe Generator is free software; you can redistribute it 5 | * and/or modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 3 of 7 | * the License, or(at your option) any later version. 8 | *

9 | * The Astrolabe Generator is distributed in the hope that it will be 10 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 11 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | *

14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *

18 | * Copyright (c) 2017 Timothy J. Mitchell 19 | */ 20 | package com.wymarc.astrolabe.generator.gui.tabbedview; 21 | 22 | import com.wymarc.astrolabe.Astrolabe; 23 | import com.wymarc.astrolabe.generator.gui.GeneratorGui; 24 | 25 | import javax.swing.*; 26 | import java.awt.*; 27 | import java.awt.event.ActionEvent; 28 | import java.awt.event.ActionListener; 29 | import java.awt.event.MouseEvent; 30 | import java.awt.event.MouseListener; 31 | 32 | public class RetePanel extends JPanel implements ActionListener,MouseListener { 33 | private JComboBox reteOptionsCombo = null; 34 | private ThumbNail thumbNail = null; 35 | 36 | public RetePanel() { 37 | super(); 38 | setLayout(new BorderLayout()); 39 | 40 | JPanel leftPanel = new JPanel(); 41 | leftPanel.setLayout(new BorderLayout()); 42 | 43 | JPanel optionsPanel = new JPanel(); 44 | optionsPanel.setLayout(new GridBagLayout()); 45 | 46 | JLabel label = new JLabel("Rete style:"); 47 | GridBagConstraints c = new GridBagConstraints(); 48 | c.fill = GridBagConstraints.HORIZONTAL; 49 | c.insets = new Insets(5,10,5,5); 50 | c.gridx = 0; 51 | c.gridy = 0; 52 | optionsPanel.add(label,c); 53 | c.gridx = 1; 54 | c.gridy = 0; 55 | optionsPanel.add(getReteOptionsCombo(),c); 56 | 57 | leftPanel.add(optionsPanel, BorderLayout.NORTH); 58 | add(leftPanel,BorderLayout.WEST); 59 | 60 | add(getThumbNail(),BorderLayout.EAST); 61 | } 62 | 63 | public JPanel getThumbNail(){ 64 | if (null == thumbNail){ 65 | thumbNail = new ThumbNail(); 66 | } 67 | return thumbNail.updateReteThumbNail(); 68 | } 69 | 70 | private JComboBox getReteOptionsCombo(){ 71 | if (null == reteOptionsCombo){ 72 | reteOptionsCombo = new JComboBox<>(Astrolabe.RETEOPTIONS); 73 | reteOptionsCombo.setSelectedIndex(GeneratorGui.MY_ASTROLABE.getReteType()); 74 | reteOptionsCombo.setToolTipText("Select type of rete"); 75 | reteOptionsCombo.setActionCommand("Rete"); 76 | reteOptionsCombo.addActionListener(this); 77 | reteOptionsCombo.addMouseListener(this); 78 | } 79 | return reteOptionsCombo; 80 | } 81 | 82 | public void updateControls(){ 83 | getReteOptionsCombo().setSelectedIndex(GeneratorGui.MY_ASTROLABE.getReteType()); 84 | getThumbNail().updateUI(); 85 | } 86 | 87 | public void actionPerformed(ActionEvent e) { 88 | String cmd = e.getActionCommand(); 89 | 90 | if (cmd.equals("Rete")) { 91 | GeneratorGui.MY_ASTROLABE.setReteType(getReteOptionsCombo().getSelectedIndex()); 92 | getThumbNail().updateUI(); 93 | } 94 | } 95 | 96 | public void mouseClicked(MouseEvent e) { 97 | 98 | } 99 | 100 | public void mousePressed(MouseEvent e) { 101 | 102 | } 103 | 104 | public void mouseReleased(MouseEvent e) { 105 | 106 | } 107 | 108 | public void mouseEntered(MouseEvent e) { 109 | String text = ""; 110 | Object obj = e.getSource(); 111 | if (obj instanceof JComboBox){ 112 | text = ((JComboBox) obj).getToolTipText(); 113 | }else if (obj instanceof JCheckBox){ 114 | text = ((JCheckBox) obj).getToolTipText(); 115 | } 116 | 117 | GeneratorGui.setStatusLabel(text); 118 | } 119 | 120 | public void mouseExited(MouseEvent e) { 121 | GeneratorGui.setStatusLabel(""); 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /src/main/java/com/wymarc/astrolabe/generator/gui/GeneratorMenuBar.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: AstrolabeGenerator.java,v 3.1 3 | *

4 | * The Astrolabe Generator is free software; you can redistribute it 5 | * and/or modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 3 of 7 | * the License, or(at your option) any later version. 8 | *

9 | * The Astrolabe Generator is distributed in the hope that it will be 10 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 11 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | *

14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *

18 | * Copyright (c) 2017 Timothy J. Mitchell 19 | */ 20 | package com.wymarc.astrolabe.generator.gui; 21 | 22 | import com.wymarc.astrolabe.generator.config.AstrolabeExample; 23 | 24 | import javax.swing.*; 25 | import java.awt.event.KeyEvent; 26 | import java.util.List; 27 | 28 | public class GeneratorMenuBar extends JMenuBar { 29 | public GeneratorMenuBar(GeneratorGui generator) { 30 | JMenu menu; 31 | JMenuItem menuItem; 32 | 33 | menu = new JMenu("File"); 34 | menu.setMnemonic(KeyEvent.VK_F); 35 | menu.getAccessibleContext().setAccessibleDescription("File operations"); 36 | add(menu); 37 | 38 | menuItem = new JMenuItem("Save to folder", KeyEvent.VK_S); 39 | menuItem.getAccessibleContext().setAccessibleDescription("Save to folder"); 40 | menuItem.addActionListener(generator); 41 | menu.add(menuItem); 42 | 43 | menuItem = new JMenuItem("Save to Zip", KeyEvent.VK_Z); 44 | menuItem.getAccessibleContext().setAccessibleDescription("Save to Zip"); 45 | menuItem.addActionListener(generator); 46 | menu.add(menuItem); 47 | 48 | menuItem = new JMenuItem("Print all", KeyEvent.VK_P); 49 | menuItem.getAccessibleContext().setAccessibleDescription("Print all"); 50 | menuItem.addActionListener(generator); 51 | menuItem.setEnabled(GeneratorGui.HAS_PRINTER_SUPPORT); 52 | menu.add(menuItem); 53 | 54 | menuItem = new JMenuItem("Print current view", KeyEvent.VK_C); 55 | menuItem.getAccessibleContext().setAccessibleDescription("Print current view"); 56 | menuItem.addActionListener(generator); 57 | menuItem.setEnabled(GeneratorGui.HAS_PRINTER_SUPPORT); 58 | menu.add(menuItem); 59 | 60 | menu.addSeparator(); 61 | menu.add( new ExitAction() ); 62 | 63 | menu = new JMenu("Predefined Astrolabes"); 64 | menu.setMnemonic(KeyEvent.VK_P); 65 | menu.getAccessibleContext().setAccessibleDescription("Predefined Astrolabes"); 66 | menuItem.addActionListener(generator); 67 | add(menu); 68 | 69 | List astrolabeList = GeneratorGui.MY_CONFIG.getAstrolabeExamples(); 70 | for (AstrolabeExample astrolabe:astrolabeList ){ 71 | menuItem = new JMenuItem(astrolabe.getName()); 72 | menuItem.getAccessibleContext().setAccessibleDescription(astrolabe.getName()); 73 | menuItem.addActionListener(generator); 74 | menu.add(menuItem); 75 | } 76 | 77 | menu = new JMenu("Help"); 78 | menu.setMnemonic(KeyEvent.VK_H); 79 | menu.getAccessibleContext().setAccessibleDescription("Help"); 80 | menuItem.addActionListener(generator); 81 | add(menu); 82 | 83 | menuItem = new JMenuItem("About", KeyEvent.VK_A); 84 | menuItem.getAccessibleContext().setAccessibleDescription("About"); 85 | menuItem.addActionListener(generator); 86 | menu.add(menuItem); 87 | 88 | menuItem = new JMenuItem("Program Help", KeyEvent.VK_P); 89 | menuItem.getAccessibleContext().setAccessibleDescription("Program Help"); 90 | menuItem.addActionListener(generator); 91 | menu.add(menuItem); 92 | 93 | menuItem = new JMenuItem("Astrolabe Resources", KeyEvent.VK_R); 94 | menuItem.getAccessibleContext().setAccessibleDescription("Astrolabe Resources"); 95 | menuItem.addActionListener(generator); 96 | menu.add(menuItem); 97 | 98 | menuItem = new JMenuItem("Assembly Instructions"); 99 | menuItem.getAccessibleContext().setAccessibleDescription("Assembly Instructions"); 100 | menuItem.addActionListener(generator); 101 | menu.add(menuItem); 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /src/main/java/com/wymarc/astrolabe/generator/gui/tabbedview/AstrolabeVariationsPanel.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: AstrolabeGenerator.java,v 3.1 3 | *

4 | * The Astrolabe Generator is free software; you can redistribute it 5 | * and/or modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 3 of 7 | * the License, or(at your option) any later version. 8 | *

9 | * The Astrolabe Generator is distributed in the hope that it will be 10 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 11 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | *

14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *

18 | * Copyright (c) 2017 Timothy J. Mitchell 19 | */ 20 | package com.wymarc.astrolabe.generator.gui.tabbedview; 21 | 22 | import com.wymarc.astrolabe.generator.AstrolabeGenerator; 23 | import com.wymarc.astrolabe.generator.gui.GeneratorGui; 24 | 25 | import javax.swing.*; 26 | import java.awt.*; 27 | import java.awt.event.ActionEvent; 28 | import java.awt.event.ActionListener; 29 | import java.awt.event.MouseEvent; 30 | import java.awt.event.MouseListener; 31 | 32 | public class AstrolabeVariationsPanel extends JPanel implements ActionListener,MouseListener { 33 | private JCheckBox universalCheck = null; 34 | 35 | public AstrolabeVariationsPanel(){ 36 | super(); 37 | setLayout(new BorderLayout()); 38 | 39 | JPanel leftPanel = new JPanel(); 40 | leftPanel.setLayout(new BorderLayout()); 41 | 42 | JPanel optionsPanel = new JPanel(); 43 | optionsPanel.setLayout(new GridBagLayout()); 44 | 45 | JLabel optionsLabel = new JLabel("Variations on the basic astrolabe:"); 46 | GridBagConstraints c = new GridBagConstraints(); 47 | c.fill = GridBagConstraints.HORIZONTAL; 48 | c.insets = new Insets(5,10,5,5); 49 | c.gridx = 0; 50 | c.gridy = 0; 51 | optionsPanel.add(optionsLabel,c); 52 | c.gridy++; 53 | optionsPanel.add(getUniversalCheck(),c); 54 | leftPanel.add(optionsPanel, BorderLayout.NORTH); 55 | add(leftPanel, BorderLayout.WEST); 56 | 57 | ImageIcon icon = createImageIcon("gui/images/misc/universal.png"); 58 | JLabel iconLabel = new JLabel(icon); 59 | if (null != icon){ 60 | iconLabel.setBounds(0, 0, icon.getIconWidth(), icon.getIconHeight()); 61 | } 62 | add(iconLabel,BorderLayout.EAST); 63 | } 64 | 65 | /** Returns an ImageIcon, or null if the path was invalid. */ 66 | private ImageIcon createImageIcon(String path) { 67 | java.net.URL imgURL = AstrolabeGenerator.class.getResource(path); 68 | if (imgURL != null) { 69 | return new ImageIcon(imgURL); 70 | } else { 71 | System.err.println("Couldn't find file: " + path); 72 | return null; 73 | } 74 | } 75 | 76 | private JCheckBox getUniversalCheck(){ 77 | if (null == universalCheck){ 78 | universalCheck = new JCheckBox("Universal Astrolabe"); 79 | universalCheck.setSelected(GeneratorGui.MY_ASTROLABE.getPrintUniversalAstrolabe()); 80 | universalCheck.setToolTipText("Include the files for the Universal Astrolabe"); 81 | universalCheck.setActionCommand("Universal"); 82 | universalCheck.addActionListener(this); 83 | universalCheck.addMouseListener(this); 84 | } 85 | return universalCheck; 86 | } 87 | 88 | public void actionPerformed(ActionEvent e) { 89 | String cmd = e.getActionCommand(); 90 | 91 | if (cmd.equals("Universal")) { 92 | GeneratorGui.MY_ASTROLABE.setPrintUniversalAstrolabe(universalCheck.isSelected()); 93 | } 94 | } 95 | 96 | public void mouseClicked(MouseEvent e) { 97 | 98 | } 99 | 100 | public void mousePressed(MouseEvent e) { 101 | 102 | } 103 | 104 | public void mouseReleased(MouseEvent e) { 105 | 106 | } 107 | 108 | public void mouseEntered(MouseEvent e) { 109 | String text = ""; 110 | Object obj = e.getSource(); 111 | if (obj instanceof JComboBox){ 112 | text = ((JComboBox) obj).getToolTipText(); 113 | }else if (obj instanceof JCheckBox){ 114 | text = ((JCheckBox) obj).getToolTipText(); 115 | } 116 | 117 | GeneratorGui.setStatusLabel(text); 118 | } 119 | 120 | public void mouseExited(MouseEvent e) { 121 | GeneratorGui.setStatusLabel(""); 122 | } 123 | 124 | 125 | } 126 | -------------------------------------------------------------------------------- /src/main/java/com/wymarc/astrolabe/generator/gui/dialogs/HelpDialog.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: AstrolabeGenerator.java,v 3.1 3 | *

4 | * The Astrolabe Generator is free software; you can redistribute it 5 | * and/or modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 3 of 7 | * the License, or(at your option) any later version. 8 | *

9 | * The Astrolabe Generator is distributed in the hope that it will be 10 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 11 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | *

14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *

18 | * Copyright (c) 2017 Timothy J. Mitchell 19 | */ 20 | package com.wymarc.astrolabe.generator.gui.dialogs; 21 | 22 | import com.wymarc.astrolabe.generator.AstrolabeGenerator; 23 | import com.wymarc.astrolabe.generator.config.Config; 24 | 25 | import javax.swing.*; 26 | import javax.swing.border.EmptyBorder; 27 | import java.awt.*; 28 | 29 | public class HelpDialog extends JDialog { 30 | public HelpDialog(JFrame frame) { 31 | super(frame, true); 32 | init(); 33 | pack(); 34 | setLocationRelativeTo(frame); 35 | setVisible(true); 36 | } 37 | 38 | private void init() { 39 | setPreferredSize(new Dimension(600,400)); 40 | setResizable(false); 41 | setLayout(new BorderLayout()); 42 | setTitle("Help"); 43 | 44 | add(getIcon(), BorderLayout.WEST); 45 | add(getTextPanel(), BorderLayout.EAST); 46 | add(getBottomPanel(), BorderLayout.SOUTH); 47 | } 48 | 49 | private JPanel getTextPanel(){ 50 | JPanel textPanel = new JPanel(); 51 | textPanel.setBorder(new EmptyBorder(0,0,0,15)); 52 | textPanel.setLayout(new GridBagLayout()); 53 | GridBagConstraints c = new GridBagConstraints(); 54 | c.fill = GridBagConstraints.HORIZONTAL; 55 | c.insets = new Insets(5,10,5,5); 56 | c.gridx = 0; 57 | c.gridy = 0; 58 | 59 | JLabel title = new JLabel("The Astrolabe Generator"); 60 | title.setHorizontalAlignment(JLabel.RIGHT); 61 | title.setFont(new Font("Times New Roman", Font.BOLD + Font.ITALIC, 20)); 62 | title.setForeground(Color.BLUE); 63 | textPanel.add(title, c); 64 | 65 | JLabel version = new JLabel("Version " + Config.version); 66 | version.setHorizontalAlignment(JLabel.RIGHT); 67 | version.setFont(new Font("Times New Roman", Font.PLAIN, 12)); 68 | c.gridy = 1; 69 | textPanel.add(version, c); 70 | 71 | JTextPane textArea = new JTextPane(); 72 | textArea.setOpaque(false); 73 | textArea.setContentType("text/html"); 74 | textArea.setEditable(false); 75 | String text = "This program will generate a set of PostScript files for
"; 76 | text += "printing or other use. You will need to know your current
"; 77 | text += "location in degrees, minutes and seconds (454545N 1232323E
"; 78 | text += "for example).

"; 79 | text += "See Help, Astrolabe Resources for links to software for
"; 80 | text += "displaying and printing."; 81 | textArea.setText(text); 82 | c.gridy = 2; 83 | textPanel.add(textArea,c); 84 | 85 | return textPanel; 86 | } 87 | 88 | private JPanel getBottomPanel(){ 89 | JPanel bottom = new JPanel(); 90 | bottom.setBorder(new EmptyBorder(10,0,10,0)); 91 | bottom.setLayout(new GridBagLayout()); 92 | GridBagConstraints c = new GridBagConstraints(); 93 | c.fill = GridBagConstraints.HORIZONTAL; 94 | c.insets = new Insets(0,20,0,20); 95 | c.gridx = 0; 96 | c.gridy = 0; 97 | 98 | JLabel contact1 = new JLabel("Project page: http://sourceforge.net/projects/astrolabegenera"); 99 | contact1.setFont(new Font("Times New Roman", Font.PLAIN, 12)); 100 | bottom.add(contact1,c); 101 | 102 | JLabel contact2 = new JLabel("Home page: http://astrolabeproject.com"); 103 | contact2.setFont(new Font("Times New Roman", Font.PLAIN, 12)); 104 | c.gridy = 1; 105 | bottom.add(contact2,c); 106 | 107 | c.gridx = 1; 108 | c.gridy = 1; 109 | JButton okayButton = new javax.swing.JButton("OK"); 110 | okayButton.addActionListener(new java.awt.event.ActionListener() { 111 | public void actionPerformed(java.awt.event.ActionEvent evt) { 112 | okayButtonActionPerformed(evt); 113 | } 114 | }); 115 | bottom.add(okayButton,c); 116 | 117 | 118 | return bottom; 119 | } 120 | 121 | private JLabel getIcon(){ 122 | java.net.URL imgURL = AstrolabeGenerator.class.getResource("gui/images/logo.png"); 123 | if (imgURL != null) { 124 | JLabel icon = new JLabel((new ImageIcon(imgURL))); 125 | icon.setBorder(new EmptyBorder(0,15,0,0)); 126 | return icon; 127 | } 128 | return new JLabel(); 129 | } 130 | 131 | private void okayButtonActionPerformed(java.awt.event.ActionEvent evt){ 132 | this.dispose(); 133 | } 134 | 135 | } 136 | 137 | 138 | -------------------------------------------------------------------------------- /src/main/java/com/wymarc/astrolabe/generator/gui/dialogs/ResourcesDialog.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: AstrolabeGenerator.java,v 3.1 3 | *

4 | * The Astrolabe Generator is free software; you can redistribute it 5 | * and/or modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 3 of 7 | * the License, or(at your option) any later version. 8 | *

9 | * The Astrolabe Generator is distributed in the hope that it will be 10 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 11 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | *

14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *

18 | * Copyright (c) 2017 Timothy J. Mitchell 19 | */ 20 | package com.wymarc.astrolabe.generator.gui.dialogs; 21 | 22 | import com.wymarc.astrolabe.generator.AstrolabeGenerator; 23 | import com.wymarc.astrolabe.generator.config.Config; 24 | 25 | import javax.swing.*; 26 | import javax.swing.border.EmptyBorder; 27 | import java.awt.*; 28 | 29 | public class ResourcesDialog extends JDialog { 30 | public ResourcesDialog(JFrame frame) { 31 | super(frame, true); 32 | init(); 33 | pack(); 34 | setLocationRelativeTo(frame); 35 | setVisible(true); 36 | } 37 | 38 | private void init() { 39 | setPreferredSize(new Dimension(600,500)); 40 | setResizable(false); 41 | setLayout(new BorderLayout()); 42 | setTitle("Resources"); 43 | 44 | add(getIcon(), BorderLayout.WEST); 45 | add(getTextPanel(), BorderLayout.EAST); 46 | add(getBottomPanel(), BorderLayout.SOUTH); 47 | } 48 | 49 | private JPanel getTextPanel(){ 50 | JPanel textPanel = new JPanel(); 51 | textPanel.setBorder(new EmptyBorder(0,0,0,15)); 52 | textPanel.setLayout(new GridBagLayout()); 53 | GridBagConstraints c = new GridBagConstraints(); 54 | c.fill = GridBagConstraints.HORIZONTAL; 55 | c.insets = new Insets(5,10,5,5); 56 | c.gridx = 0; 57 | c.gridy = 0; 58 | 59 | JLabel title = new JLabel("The Astrolabe Generator"); 60 | title.setHorizontalAlignment(JLabel.RIGHT); 61 | title.setFont(new Font("Times New Roman", Font.BOLD+Font.ITALIC, 20)); 62 | title.setForeground(Color.BLUE); 63 | textPanel.add(title,c); 64 | 65 | JLabel version = new JLabel("Version " + Config.version); 66 | version.setHorizontalAlignment(JLabel.RIGHT); 67 | version.setFont(new Font("Times New Roman", Font.PLAIN, 12)); 68 | c.gridy = 1; 69 | textPanel.add(version,c); 70 | 71 | JTextPane textArea = new JTextPane(); 72 | textArea.setOpaque(false); 73 | textArea.setContentType("text/html"); 74 | textArea.setEditable(false); 75 | String text = "Useful Links:

"; 76 | text += "Project Page:
"; 77 | text += "http://sourceforge.net/projects/astrolabegenera/

"; 78 | text += "Viewing PostScript files:
"; 79 | text += "http://pages.cs.wisc.edu/~ghost/gsview/

"; 80 | text += "Printing PostScript files:
"; 81 | text += "http://www.lerup.com/printfile/

"; 82 | text += "The Astrolabe Project website:
"; 83 | text += "http://www.astrolabeproject.com

"; 84 | textArea.setText(text); 85 | c.gridy = 2; 86 | textPanel.add(textArea,c); 87 | return textPanel; 88 | } 89 | 90 | private JPanel getBottomPanel(){ 91 | JPanel bottom = new JPanel(); 92 | bottom.setBorder(new EmptyBorder(10,0,10,0)); 93 | bottom.setLayout(new GridBagLayout()); 94 | GridBagConstraints c = new GridBagConstraints(); 95 | c.fill = GridBagConstraints.HORIZONTAL; 96 | c.insets = new Insets(0,20,0,20); 97 | c.gridx = 0; 98 | c.gridy = 0; 99 | 100 | JLabel contact1 = new JLabel("Project page: http://sourceforge.net/projects/astrolabegenera"); 101 | contact1.setFont(new Font("Times New Roman", Font.PLAIN, 12)); 102 | bottom.add(contact1,c); 103 | 104 | JLabel contact2 = new JLabel("Home page: http://astrolabeproject.com"); 105 | contact2.setFont(new Font("Times New Roman", Font.PLAIN, 12)); 106 | c.gridy = 1; 107 | bottom.add(contact2,c); 108 | 109 | c.gridx = 1; 110 | c.gridy = 1; 111 | JButton okayButton = new javax.swing.JButton("OK"); 112 | okayButton.addActionListener(new java.awt.event.ActionListener() { 113 | public void actionPerformed(java.awt.event.ActionEvent evt) { 114 | okayButtonActionPerformed(evt); 115 | } 116 | }); 117 | bottom.add(okayButton,c); 118 | 119 | 120 | return bottom; 121 | } 122 | 123 | private JLabel getIcon(){ 124 | java.net.URL imgURL = AstrolabeGenerator.class.getResource("gui/images/logo.png"); 125 | if (imgURL != null) { 126 | JLabel icon = new JLabel((new ImageIcon(imgURL))); 127 | icon.setBorder(new EmptyBorder(0,15,0,0)); 128 | return icon; 129 | } 130 | return new JLabel(); 131 | } 132 | 133 | private void okayButtonActionPerformed(java.awt.event.ActionEvent evt){ 134 | this.dispose(); 135 | } 136 | 137 | } 138 | 139 | -------------------------------------------------------------------------------- /src/main/java/com/wymarc/astrolabe/math/ThreePointCenter.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: AstrolabeGenerator.java,v 3.1 3 | *

4 | * The Astrolabe Generator is free software; you can redistribute it 5 | * and/or modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 3 of 7 | * the License, or(at your option) any later version. 8 | *

9 | * The Astrolabe Generator is distributed in the hope that it will be 10 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 11 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | *

14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *

18 | * Copyright (c) 2017 Timothy J. Mitchell 19 | */ 20 | package com.wymarc.astrolabe.math; 21 | 22 | import java.awt.geom.Point2D; 23 | 24 | /** 25 | * Given three points on a plain, this class will compute the common center and the radius 26 | * of the circle than is defined by those points 27 | * 28 | * Date: 1 October 2011 29 | * Author Timothy J. Mitchell (wymarc@gmail.com) 30 | * 31 | * (Modified from other sources-see below) 32 | * 33 | * This is modification based loosely on the C example code circle3 routine by 34 | * James Morrison published in The Astrolabe 35 | * 36 | * Notes: 37 | * 38 | * There are two boundary conditions that must be dealt with: 39 | * 1. If two of the points have the same y-axis co-ordinate (i.e. 12,7; 87,7) 40 | * this can cause a divide-by-zero error in the code 41 | * 42 | * 2. If all three points lie on the same line, there is no circle that they define. 43 | * 44 | */ 45 | public class ThreePointCenter { 46 | 47 | private Point2D.Double center= new Point2D.Double(0,0); 48 | private double radius = 0; 49 | private Boolean isCircle = true; 50 | 51 | public Point2D.Double getCenter() { 52 | return this.center; 53 | } 54 | 55 | public double getRadius() { 56 | return this.radius; 57 | } 58 | 59 | public Boolean isCircle() { 60 | return this.isCircle; 61 | } 62 | 63 | public ThreePointCenter(Point2D.Double point1, Point2D.Double point2, Point2D.Double point3){ 64 | Point2D.Double pointZ; 65 | 66 | double temp1; 67 | double temp2; 68 | 69 | double deltaX1; 70 | double deltaY1; 71 | double deltaX2; 72 | double deltaY2; 73 | 74 | // first check to see if the three points are on the same line 75 | // Use two points to derive the equation of a line between those points 76 | // then see if the third point is on that line 77 | if((point1.x == point2.x && point2.x == point3.x)||(point1.y == point2.y && point2.y == point3.y)) 78 | { 79 | //is a straight horz or vert line 80 | this.isCircle = false; 81 | return; 82 | } 83 | 84 | //Check to make sure point2.x does not equal point3.x. if equal swap out for point3 85 | if (point2.x == point1.x) 86 | { 87 | // swap 88 | if (point2.x != point3.x) 89 | { 90 | // swap point2 and point3 91 | pointZ = point3; 92 | point3 = point2; 93 | point2 = pointZ; 94 | }else 95 | { 96 | // swap point1 and point3 97 | pointZ = point3; 98 | point3 = point1; 99 | point1 = pointZ; 100 | } 101 | } 102 | 103 | // now test to see if point3 is on the same line as point1 and point2 104 | double slope = (point2.y - point1.y) / (point2.x - point1.x); 105 | double intercept = point1.y - (slope * point1.x); 106 | 107 | if(point3.y == (slope * point3.x) + intercept) //y = mx+b 108 | { 109 | //all three points on one line 110 | this.isCircle = false; 111 | return; 112 | } 113 | 114 | // next check to see if point2.y is the same as point1.y or if 115 | // point3.y is the same as point1.y if so there is a divide-by-zero 116 | // problem that can be solved by swapping points around. 117 | // we check above to see if the points were on a horz or vert line, so if 118 | // point2.y is the same as point1.y then point3.y can't be etc 119 | 120 | if (point2.y == point1.y) 121 | { 122 | // swap point1 and point3 123 | pointZ = point3; 124 | point3 = point1; 125 | point1 = pointZ; 126 | } else if (point3.y == point1.y) 127 | { 128 | // swap point1 and point2 129 | pointZ = point2; 130 | point2 = point1; 131 | point1 = pointZ; 132 | } 133 | 134 | // Find point equidistant from point1, point2 and point 3 135 | 136 | deltaX1 = point2.x - point1.x; 137 | deltaY1 = point2.y - point1.y; 138 | temp1 = ((point2.x * point2.x) - (point1.x * point1.x) + (point2.y * point2.y) - (point1.y * point1.y)) / 2.0; 139 | deltaX2 = point3.x - point1.x; 140 | deltaY2 = point3.y - point1.y; 141 | temp2 = ((point3.x * point3.x) - (point1.x * point1.x) + (point3.y * point3.y) - (point1.y * point1.y)) / 2.0; 142 | 143 | // solve for X 144 | this.center.x = ((temp1 / deltaY1) - (temp2 / deltaY2)) / ((deltaX1 / deltaY1) - (deltaX2 / deltaY2)); 145 | 146 | // solve for Y 147 | this.center.y = (temp1 - (deltaX1 * this.center.x)) / deltaY1; 148 | 149 | this.radius = Math.sqrt(((this.center.x - point1.x) * (this.center.x - point1.x)) + ((this.center.y - point1.y) * (this.center.y - point1.y))); 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /src/main/java/com/wymarc/astrolabe/generator/gui/dialogs/AboutDialog.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: AstrolabeGenerator.java,v 3.1 3 | *

4 | * The Astrolabe Generator is free software; you can redistribute it 5 | * and/or modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 3 of 7 | * the License, or(at your option) any later version. 8 | *

9 | * The Astrolabe Generator is distributed in the hope that it will be 10 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 11 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | *

14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *

18 | * Copyright (c) 2017 Timothy J. Mitchell 19 | */ 20 | package com.wymarc.astrolabe.generator.gui.dialogs; 21 | 22 | import com.wymarc.astrolabe.generator.AstrolabeGenerator; 23 | import com.wymarc.astrolabe.generator.config.Config; 24 | 25 | import javax.swing.*; 26 | import javax.swing.border.EmptyBorder; 27 | import java.awt.*; 28 | 29 | 30 | public class AboutDialog extends JDialog { 31 | public AboutDialog(JFrame frame) { 32 | super(frame, true); 33 | init(); 34 | pack(); 35 | setLocationRelativeTo(frame); 36 | setVisible(true); 37 | } 38 | 39 | private void init() { 40 | setPreferredSize(new Dimension(600,480)); 41 | setResizable(false); 42 | setLayout(new BorderLayout()); 43 | setTitle("About"); 44 | 45 | add(getIcon(), BorderLayout.WEST); 46 | add(getTextPanel(), BorderLayout.EAST); 47 | add(getBottomPanel(), BorderLayout.SOUTH); 48 | } 49 | 50 | private JPanel getTextPanel(){ 51 | JPanel textPanel = new JPanel(); 52 | textPanel.setBorder(new EmptyBorder(0,0,0,15)); 53 | textPanel.setLayout(new GridBagLayout()); 54 | GridBagConstraints c = new GridBagConstraints(); 55 | c.fill = GridBagConstraints.HORIZONTAL; 56 | c.insets = new Insets(5,10,5,5); 57 | c.gridx = 0; 58 | c.gridy = 0; 59 | 60 | JLabel title = new JLabel("The Astrolabe Generator"); 61 | title.setHorizontalAlignment(JLabel.RIGHT); 62 | title.setFont(new Font("Times New Roman", Font.BOLD+Font.ITALIC, 20)); 63 | title.setForeground(Color.BLUE); 64 | textPanel.add(title,c); 65 | 66 | JLabel version = new JLabel("Version " + Config.version); 67 | version.setHorizontalAlignment(JLabel.RIGHT); 68 | version.setFont(new Font("Times New Roman", Font.PLAIN, 12)); 69 | c.gridy = 1; 70 | textPanel.add(version,c); 71 | 72 | JTextPane textArea = new JTextPane(); 73 | textArea.setOpaque(false); 74 | textArea.setContentType("text/html"); 75 | textArea.setEditable(false); 76 | // todo: set up text wrapping: http://stackoverflow.com/questions/4702891/toggling-text-wrap-in-a-jtextpane 77 | String text = "Dedicated to the memory of James E. Morrison
author of The Astrolabe


"; 78 | text += "The Astrolabe Generator is free software; you can
"; 79 | text += "redistribute it and/or modify it under the terms of the
"; 80 | text += "GNU General Public License as published by the Free
"; 81 | text += "Software Foundation; either version 2 of the License,
"; 82 | text += "or (at your option) any later version.

"; 83 | text += "The Astrolabe Generator is distributed in the hope that
"; 84 | text += "it will be useful, but WITHOUT ANY WARRANTY; without
"; 85 | text += "even the implied warranty of MERCHANTABILITY or
"; 86 | text += "FITNESS FOR A PARTICULAR PURPOSE. See the GNU
"; 87 | text += "General Public License for more details."; 88 | textArea.setText(text); 89 | c.gridy = 2; 90 | textPanel.add(textArea,c); 91 | 92 | JLabel copyRight = new JLabel("Copyright(c) 2014 - 2017 Timothy J . Mitchell"); 93 | copyRight.setFont(new Font("Times New Roman", Font.PLAIN, 12)); 94 | c.gridy = 3; 95 | textPanel.add(copyRight,c); 96 | 97 | return textPanel; 98 | } 99 | 100 | private JPanel getBottomPanel(){ 101 | JPanel bottom = new JPanel(); 102 | bottom.setBorder(new EmptyBorder(10,0,10,0)); 103 | bottom.setLayout(new GridBagLayout()); 104 | GridBagConstraints c = new GridBagConstraints(); 105 | c.fill = GridBagConstraints.HORIZONTAL; 106 | c.insets = new Insets(0,20,0,20); 107 | c.gridx = 0; 108 | c.gridy = 0; 109 | 110 | JLabel contact1 = new JLabel("Project page: http://sourceforge.net/projects/astrolabegenera"); 111 | contact1.setFont(new Font("Times New Roman", Font.PLAIN, 12)); 112 | bottom.add(contact1,c); 113 | 114 | JLabel contact2 = new JLabel("Home page: http://astrolabeproject.com"); 115 | contact2.setFont(new Font("Times New Roman", Font.PLAIN, 12)); 116 | c.gridy = 1; 117 | bottom.add(contact2,c); 118 | 119 | c.gridx = 1; 120 | c.gridy = 1; 121 | JButton okayButton = new javax.swing.JButton("OK"); 122 | okayButton.addActionListener(new java.awt.event.ActionListener() { 123 | public void actionPerformed(java.awt.event.ActionEvent evt) { 124 | okayButtonActionPerformed(evt); 125 | } 126 | }); 127 | bottom.add(okayButton,c); 128 | 129 | 130 | return bottom; 131 | } 132 | 133 | private JLabel getIcon(){ 134 | java.net.URL imgURL = AstrolabeGenerator.class.getResource("gui/images/logo.png"); 135 | if (imgURL != null) { 136 | JLabel icon = new JLabel((new ImageIcon(imgURL))); 137 | icon.setBorder(new EmptyBorder(0,15,0,0)); 138 | return icon; 139 | } 140 | return new JLabel(); 141 | } 142 | 143 | private void okayButtonActionPerformed(java.awt.event.ActionEvent evt){ 144 | this.dispose(); 145 | } 146 | 147 | } 148 | 149 | -------------------------------------------------------------------------------- /src/main/java/com/wymarc/astrolabe/generator/printengines/postscript/extras/DemoArms.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: AstrolabeGenerator.java,v 3.1 3 | *

4 | * The Astrolabe Generator is free software; you can redistribute it 5 | * and/or modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 3 of 7 | * the License, or(at your option) any later version. 8 | *

9 | * The Astrolabe Generator is distributed in the hope that it will be 10 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 11 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | *

14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *

18 | * Copyright (c) 2017 Timothy J. Mitchell 19 | */ 20 | package com.wymarc.astrolabe.generator.printengines.postscript.extras; 21 | 22 | import com.wymarc.astrolabe.generator.printengines.postscript.util.EPSToolKit; 23 | 24 | public class DemoArms { 25 | 26 | private String drawQuadrantScale(double scaleLength){ 27 | String out = ""; 28 | double interval1 = scaleLength/60.0; 29 | double interval5 = scaleLength/12.0; 30 | 31 | // draw scale 32 | out += "\n" + "0 0 moveto"; 33 | out += "\n" + "0 15 lineto"; 34 | out += "\n" + scaleLength + " 15 lineto"; 35 | out += "\n" + scaleLength + " 0 lineto"; 36 | out += "\n" + "0 0 lineto stroke"; 37 | out += "\n" + "0 3 moveto"; 38 | out += "\n" + scaleLength + " 3 lineto stroke"; 39 | 40 | // mark and label 41 | out += "\n" + "NormalFont12 setfont"; 42 | for (int i=1; i<=12; i++){ 43 | out += "\n" + "newpath"; 44 | out += "\n" + interval5*i + " 3 moveto"; 45 | out += "\n" + interval5*i + " 15 lineto stroke"; 46 | if (i>1){ 47 | out += "\n" + (interval5*i-14) + " 5 moveto"; 48 | }else{ 49 | out += "\n" + (interval5*i-8) + " 5 moveto"; 50 | } 51 | out += "\n" + "(" + (i*5) + ") show"; 52 | } 53 | for (int i=1; i<=60; i++){ 54 | out += "\n" + "newpath"; 55 | out += "\n" + interval1*i + " 0 moveto"; 56 | out += "\n" + interval1*i + " 3 lineto stroke"; 57 | } 58 | 59 | 60 | // draw ends 61 | out += "\n" + scaleLength + " 15 moveto"; 62 | out += "\n" + (scaleLength+24.0) + " 15 lineto stroke"; 63 | out += "\n" + (scaleLength+24.0) + " 0 15 270 90 arc stroke"; 64 | out += "\n" + (scaleLength+24.0) + " -15 moveto"; 65 | out += "\n" + "0 -15 lineto stroke"; 66 | out += "\n" + "0 0 15 90 270 arc stroke"; 67 | out += "\n" + scaleLength + " 0 moveto"; 68 | out += "\n" + (scaleLength+24.0) + " 0 lineto stroke"; 69 | //draw pointer 70 | out += "\n" + (scaleLength+15.0) + " 0 moveto"; 71 | out += "\n" + (scaleLength+24.0) + " 6 lineto"; 72 | out += "\n" + (scaleLength+24.0) + " -6 lineto"; 73 | out += "\n" + (scaleLength+15.0) + " 0 lineto fill"; 74 | 75 | return out; 76 | } 77 | 78 | private String drawQuadrantOneSineScale(){ 79 | String out = ""; 80 | double scaleLength = 403.0; 81 | // draw box 403 82 | out += "\n" + "0 0 moveto"; 83 | out += "\n" + "0 15 lineto"; 84 | out += "\n" + scaleLength + " 15 lineto"; 85 | out += "\n" + scaleLength + " 0 lineto"; 86 | out += "\n" + "0 0 lineto stroke"; 87 | out += "\n" + "0 5 moveto"; 88 | out += "\n" + scaleLength + " 5 lineto stroke"; 89 | 90 | // draw ends 91 | out += "\n" + scaleLength + " 15 moveto"; 92 | out += "\n" + (scaleLength+15.0) + " 5 lineto"; 93 | out += "\n" + (scaleLength+15.0) + " 0 lineto"; 94 | out += "\n" + scaleLength + " 0 lineto stroke"; 95 | out += "\n" + (scaleLength+15.0) + " 0 moveto"; 96 | out += "\n" + (scaleLength+15.0) + " -15 lineto"; 97 | out += "\n" + "0 -15 lineto stroke"; 98 | out += "\n" + "0 0 15 90 270 arc stroke"; 99 | 100 | //mark ticks 101 | double interval = scaleLength/100.0; 102 | for(int i = 1; i<100; i++){ 103 | out += "\n" + interval*i + " 0 moveto"; 104 | if(i == 10 || i == 20 || i == 30 || i == 40 || i == 50 || i == 60 || i == 70 || i == 80 || i == 90){ 105 | out += "\n" + interval*i + " 15 lineto stroke"; 106 | out += "\n" + "NormalFont8 setfont"; 107 | out += "\n" + (interval*i) + " 7 moveto"; 108 | out += EPSToolKit.centerText(i+""); 109 | }else{ 110 | out += "\n" + interval*i + " 5 lineto stroke"; 111 | } 112 | } 113 | 114 | return out; 115 | } 116 | 117 | 118 | public String printArms(){ 119 | String out = ""; 120 | 121 | // Write header to file 122 | out += "%!PS-Adobe-3.0 EPSF-30."; 123 | out += "\n" + "%%BoundingBox: 0 0 612 792"; 124 | out += "\n" + "%%Title: Quadrant demo arms"; 125 | out += "\n" + "%%Creator: Richard Wymarc"; 126 | out += "\n" + "%%CreationDate: "; 127 | out += "\n" + "%%EndComments"; 128 | 129 | out += "\n" + "mark"; 130 | out += "\n" + "/Quadrant 10 dict def %local variable dictionary"; 131 | out += "\n" + "Quadrant begin"; 132 | out += "\n" + ""; 133 | out += "\n" + "%% setup"; 134 | out += EPSToolKit.fillBackground(); 135 | out += "\n" + "72 730 translate"; 136 | out += "\n" + ".4 setlinewidth"; 137 | out += "\n" + ""; 138 | out += EPSToolKit.setUpFonts(); 139 | out += "\n" + ""; 140 | 141 | for(int i = 1; i<5; i++){ 142 | out += "\n" + "gsave"; 143 | out += drawQuadrantScale(452.0); 144 | out += "\n" + "grestore"; 145 | out += "\n" + "0 -60 translate"; 146 | } 147 | for(int i = 1; i<5; i++){ 148 | out += "\n" + "gsave"; 149 | out += drawQuadrantScale(337.0); 150 | out += "\n" + "grestore"; 151 | out += "\n" + "0 -60 translate"; 152 | } 153 | for(int i = 1; i<5; i++){ 154 | out += "\n" + "gsave"; 155 | out += drawQuadrantOneSineScale(); 156 | out += "\n" + "grestore"; 157 | out += "\n" + "0 -60 translate"; 158 | } 159 | 160 | // Write Footer 161 | out += "\n" + "% Eject the page"; 162 | out += "\n" + "end cleartomark"; 163 | out += "\n" + "showpage"; 164 | 165 | return out; 166 | 167 | } 168 | 169 | } 170 | -------------------------------------------------------------------------------- /src/main/java/com/wymarc/astrolabe/Star.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: AstrolabeGenerator.java,v 3.1 3 | *

4 | * The Astrolabe Generator is free software; you can redistribute it 5 | * and/or modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 3 of 7 | * the License, or(at your option) any later version. 8 | *

9 | * The Astrolabe Generator is distributed in the hope that it will be 10 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 11 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | *

14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *

18 | * Copyright (c) 2017 Timothy J. Mitchell 19 | */ 20 | package com.wymarc.astrolabe; 21 | 22 | import java.awt.geom.Point2D; 23 | 24 | /** 25 | * provides a source of star position data * 26 | */ 27 | public class Star { 28 | public String name = ""; 29 | public double ra = 0.0; 30 | public double dec = 0.0; 31 | public Point2D.Double base1 = new Point2D.Double(); 32 | public Point2D.Double base2 = new Point2D.Double(); 33 | public Point2D.Double labelPos = new Point2D.Double(); 34 | public double labelOrient = 0.0; 35 | 36 | 37 | /** 38 | * Generates an array of Star objects 39 | * A Star object consists of: 40 | * name (String) The star's display name 41 | * ra (double) right ascension 42 | * dec (double) declination 43 | * base1 (Point2D.Double) position one base point of the rete pointer to the star 44 | * base2 (Point2D.Double) position for the other rete base point 45 | * labelPos (Point2D.Double) position for the label 46 | * labelOrient (double) label orientation 47 | * 48 | * @param hemiSphere N or S 49 | * @return Filled array of Star objects 50 | */ 51 | public static Star[] getStarsList(String hemiSphere){ 52 | 53 | Star[] starsList = new Star[17]; 54 | 55 | if (hemiSphere.equals("S")){ 56 | // show southern star set - Note Declination is reversed for the southern projection 57 | starsList[0] = new Star("Alpha Centaurus",14.75055556,-60.85277778,20,-10,10,-15,25,-7.5,0); 58 | starsList[1] = new Star("Canopus",6.542222222,-52.80555556,5,55,10,55,7.5,52.5,90); 59 | starsList[2] = new Star("Achernar",1.735833333,-57.26666667,-20,5,-15,15,-50,-7.5,0); 60 | starsList[3] = new Star("Altair",19.84636111,8.868333333,-60,-125,-70,-120,-68,-132,55); 61 | starsList[4] = new Star("Hamal",2.119527778,23.4625,0,0,0,0,-172,113,52); 62 | starsList[5] = new Star("Arcturus",14.261,19.1825,155,-95,160,-100,150,-90,-35); 63 | starsList[6] = new Star("Sirius",6.752472222,-16.71611111,5,100,5,90,7.5,90,90); 64 | starsList[7] = new Star("Procyon",7.655027778,5.225,62,125,57,125,50,127.5,-30); 65 | starsList[8] = new Star("Regulus",10.1395,11.96722222,0,0,0,0,130,85,-85); 66 | starsList[9] = new Star("Betelgeuse",5.919527778,7.406944444,-5,140,0,140,0,135,-5); 67 | starsList[10] = new Star("Rigel",5.242277778,-8.201666667,5,120,5,110,-5,111.5,0); 68 | starsList[11] = new Star("Bellatrix",5.418833333,6.349722222,-17,135,-25,135,-40,130.5,10); 69 | starsList[12] = new Star("Markab",23.07936111,15.20525,-200,-55,-195,-65,-202,-63,30); 70 | starsList[13] = new Star("Aldebaran",4.598666667,16.50916667,0,0,0,0,-87.5,147.5,40); 71 | starsList[14] = new Star("Spica",13.41986111,-11.16138889,0,0,0,0,80,-40,0); 72 | starsList[15] = new Star("Aliphard",9.459788889,-8.658602778,125,95,120,80,110,79,30); 73 | starsList[16] = new Star("Rosalhague",17.58225,12.56,5,-167,5,-160,2.5,-150,-90); 74 | 75 | }else{ 76 | //show northern star set 77 | starsList[0] = new Star("Altair",19.84636111,8.868333333,-70,115,-60,125,-67.5,120,-59); 78 | starsList[1] = new Star("Capella",5.278138889,45.99805556,5,-50,5,-60,7,-60,90); 79 | starsList[2] = new Star("Arcturus",14.261,19.1825,120,20,130,40,93,43,-20); 80 | starsList[3] = new Star("Sirius",6.752472222,-16.71611111,10,-178,10,-170,3,-176,0); 81 | starsList[4] = new Star("Procyon",7.655027778,5.225,55,-125,65,-120,50,-130,30); 82 | starsList[5] = new Star("Deneb",20.6905,45.28027778,-5,35,-5,50,-18,40,0); 83 | starsList[6] = new Star("Vega",18.61561111,38.78361111,5,90,5,70,7,60,90); 84 | starsList[7] = new Star("Betelg",5.919527778,7.406944444,0,0,0,0,-3,-109,90); 85 | starsList[8] = new Star("Rigel",5.242277778,-8.201666667,-20,-135,-30,-135,-23,-137,-4); 86 | starsList[9] = new Star("Bellatrix",5.418833333,6.349722222,-30,-135,-45,-130,-55,-127,-18); 87 | starsList[10] = new Star("Markab",23.07936111,15.20525,-105,5,-95,5,-110,2,0); 88 | starsList[11] = new Star("Aldeb",4.598666667,16.50916667,-5,-100,-5,-115,-25,-98,-40); 89 | starsList[12] = new Star("Spica",13.41986111,-11.16138889,130,70,130,50,127,47,90); 90 | starsList[13] = new Star("Alioth",12.90044444,55.95983333,35,-5,45,-5,30,-7,0); 91 | starsList[14] = new Star("Aliphard",9.459788889,-8.658602778,115,-80,110,-85,102.5,-95,52); 92 | starsList[15] = new Star("Alpheca",15.57813889,26.71472222,5,75,5,60,15,65,0); 93 | starsList[16] = new Star("Rosalhague",17.58225,12.56,0,0,0,0,7,95,90); 94 | } 95 | return starsList; 96 | } 97 | 98 | /** 99 | * Constructor for the Star object 100 | * 101 | * @param name Name of the star 102 | * @param ra Right ascension 103 | * @param dec Declination 104 | * @param base1x x coordinate of first base point 105 | * @param base1y y coordinate of first base point 106 | * @param base2x x coordinate of second base point 107 | * @param base2y y coordinate of second base point 108 | * @param labelPosx x coordinate of label position 109 | * @param labelPosy y coordinate of label position 110 | * @param labelOrient Orientation of label 0-359 111 | * 112 | */ 113 | public Star (String name,double ra, double dec, double base1x, double base1y, 114 | double base2x, double base2y, double labelPosx, double labelPosy, double labelOrient) { 115 | this.name = name; 116 | this.ra = ra; 117 | this.dec = dec; 118 | this.base1 = new Point2D.Double(base1x, base1y); 119 | this.base2 = new Point2D.Double(base2x,base2y); 120 | this.labelPos = new Point2D.Double(labelPosx,labelPosy); 121 | this.labelOrient = labelOrient; 122 | } 123 | /** 124 | * Default Constructor for the Star object 125 | * 126 | */ 127 | public Star () { 128 | this.name = ""; 129 | this. ra = 0.0; 130 | this. dec = 0.0; 131 | this. base1 = new Point2D.Double(); 132 | this. base2 = new Point2D.Double(); 133 | this. labelPos = new Point2D.Double(); 134 | this. labelOrient = 0.0; 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /src/main/java/com/wymarc/astrolabe/generator/gui/GeneratorToolBar.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: AstrolabeGenerator.java,v 3.1 3 | *

4 | * The Astrolabe Generator is free software; you can redistribute it 5 | * and/or modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 3 of 7 | * the License, or(at your option) any later version. 8 | *

9 | * The Astrolabe Generator is distributed in the hope that it will be 10 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 11 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | *

14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *

18 | * Copyright (c) 2017 Timothy J. Mitchell 19 | */ 20 | package com.wymarc.astrolabe.generator.gui; 21 | 22 | import com.wymarc.astrolabe.Location; 23 | import com.wymarc.astrolabe.generator.AstrolabeGenerator; 24 | 25 | import javax.swing.*; 26 | import java.awt.*; 27 | import java.awt.event.FocusEvent; 28 | import java.awt.event.FocusListener; 29 | import java.awt.event.MouseEvent; 30 | import java.awt.event.MouseListener; 31 | import java.net.URL; 32 | 33 | public class GeneratorToolBar extends JToolBar implements MouseListener{ 34 | private JTextField nameText = null; 35 | private JTextField locationNameText = null; 36 | private JTextField locationText = null; 37 | 38 | 39 | public GeneratorToolBar(GeneratorGui generator) { 40 | super(); 41 | setFloatable(false); 42 | setRollover(true); 43 | 44 | JButton button = new JButton(); 45 | //Look for the image. 46 | URL imageURL = AstrolabeGenerator.class.getResource("gui/images/icons/Save24.gif"); 47 | button.setIcon(new ImageIcon(imageURL, "Save")); 48 | button.setActionCommand("Save to folder"); 49 | button.setToolTipText("Save to Folder"); 50 | button.addActionListener(generator); 51 | button.addMouseListener(this); 52 | add(button); 53 | 54 | button = new JButton(); 55 | //Look for the image. 56 | imageURL = AstrolabeGenerator.class.getResource("gui/images/icons/SaveAsZip24.gif"); 57 | button.setIcon(new ImageIcon(imageURL, "Save to Zip")); 58 | button.setActionCommand("Save to Zip"); 59 | button.setToolTipText("Save to Zip"); 60 | button.addActionListener(generator); 61 | button.addMouseListener(this); 62 | add(button); 63 | 64 | button = new JButton(); 65 | //Look for the image. 66 | imageURL = AstrolabeGenerator.class.getResource("gui/images/icons/Print24.gif"); 67 | button.setIcon(new ImageIcon(imageURL, "Print")); 68 | button.setActionCommand("Print all"); 69 | button.setToolTipText("Print"); 70 | button.addActionListener(generator); 71 | button.addMouseListener(this); 72 | button.setEnabled(GeneratorGui.HAS_PRINTER_SUPPORT); 73 | add(button); 74 | 75 | addSeparator(); 76 | 77 | JPanel locationPanel = new JPanel(); 78 | locationPanel.setLayout(new GridBagLayout()); 79 | GridBagConstraints c = new GridBagConstraints(); 80 | c.fill = GridBagConstraints.HORIZONTAL; 81 | c.insets = new Insets(5,5,5,5); 82 | c.gridx = 0; 83 | c.gridy = 0; 84 | 85 | JLabel nameLabel = new JLabel("Name:"); 86 | nameText = getNameText(); 87 | locationPanel.add(nameLabel,c); 88 | c.gridx = 1; 89 | locationPanel.add(nameText,c); 90 | 91 | JLabel locationNameLabel = new JLabel("Location name:"); 92 | locationNameText = getLocationNameText(); 93 | c.gridx = 2; 94 | locationPanel.add(locationNameLabel,c); 95 | c.gridx = 3; 96 | locationPanel.add(locationNameText,c); 97 | 98 | JLabel locationLabel = new JLabel("Location:"); 99 | locationText = getLocationText(); 100 | c.gridx = 4; 101 | locationPanel.add(locationLabel,c); 102 | c.gridx = 5; 103 | locationPanel.add(locationText,c); 104 | 105 | add(locationPanel); 106 | } 107 | 108 | public JTextField getNameText() { 109 | if (null == nameText){ 110 | nameText = new JTextField("",10); 111 | nameText.setToolTipText("Name on astrolabe (optional)"); 112 | nameText.addMouseListener(this); 113 | } 114 | return nameText; 115 | } 116 | 117 | public JTextField getLocationNameText() { 118 | if (null == locationNameText){ 119 | locationNameText = new JTextField("",10); 120 | locationNameText.setToolTipText("Name of location (optional)"); 121 | locationNameText.addMouseListener(this); 122 | } 123 | return locationNameText; 124 | } 125 | 126 | public JTextField getLocationText() { 127 | if (null == locationText){ 128 | locationText = new JTextField("",12); 129 | locationText.setToolTipText("Location Coordinates (DDMMSSH DDDMMSSH)"); 130 | locationText.addMouseListener(this); 131 | locationText.addFocusListener(new FocusListener() { 132 | public void focusGained(FocusEvent e) {} 133 | public void focusLost(FocusEvent e) { 134 | if (!e.isTemporary()) { 135 | if (!Location.isValidLocation(locationText.getText())) { 136 | locationText.setForeground(Color.RED); 137 | SwingUtilities.invokeLater(new FocusGrabber(locationText)); 138 | JOptionPane.showMessageDialog(null, "Location must be in the format: ddmmssh dddmmssh. \n" + 139 | "for example, \n\n" + 140 | "45 degrees 30 minutes, 25 seconds North, \n" + 141 | "120 degrees, 40 minutes, 13 seconds West \n\n" + 142 | "would be: 453025N 1204013W","Location Error",JOptionPane.ERROR_MESSAGE); 143 | }else{ 144 | locationText.setForeground(Color.BLACK); 145 | GeneratorGui.MY_ASTROLABE.getLocation().setLocation(locationText.getText()); 146 | } 147 | } 148 | } 149 | }); 150 | } 151 | return locationText; 152 | } 153 | 154 | public void mouseClicked(MouseEvent e) { 155 | 156 | } 157 | 158 | public void mousePressed(MouseEvent e) { 159 | 160 | } 161 | 162 | public void mouseReleased(MouseEvent e) { 163 | 164 | } 165 | 166 | public void mouseEntered(MouseEvent e) { 167 | String text = ""; 168 | Object obj = e.getSource(); 169 | if (obj instanceof JTextField){ 170 | text = ((JTextField) obj).getToolTipText(); 171 | }else if (obj instanceof JButton){ 172 | text = ((JButton) obj).getToolTipText(); 173 | } 174 | 175 | GeneratorGui.setStatusLabel(text); 176 | } 177 | 178 | public void mouseExited(MouseEvent e) { 179 | GeneratorGui.setStatusLabel(""); 180 | } 181 | 182 | } 183 | -------------------------------------------------------------------------------- /src/main/java/com/wymarc/astrolabe/generator/printengines/postscript/SineGrid.java: -------------------------------------------------------------------------------- 1 | package com.wymarc.astrolabe.generator.printengines.postscript; 2 | 3 | import com.wymarc.astrolabe.Astrolabe; 4 | import com.wymarc.astrolabe.math.AstroMath; 5 | 6 | public class SineGrid { 7 | private Astrolabe myAstrolabe = new Astrolabe(); 8 | 9 | /** 10 | * computes and draws the Sin/Cos scale on the first quarter (top left) 11 | * 12 | * @return returns the ps code for drawing the SinCos Scale 13 | */ 14 | public String buildSineGrid(){ 15 | 16 | double myX; 17 | double myY; // X/Y Coordinates 18 | int i; 19 | String out = ""; 20 | 21 | //compute size of arc that contains the scale and draw it 22 | // note eventually this will be done by looking at what rings are drawn and figuring 23 | // the remaining radius 24 | double radius = myAstrolabe.getMaterRadius() - 67; 25 | 26 | //Print outline of scale 27 | 28 | out += "\n" + "%% ================ Draw Sin/Cos Scale ================="; 29 | out += "\n" + "newpath"; 30 | out += "\n" + "0 0 moveto"; 31 | out += "\n" + "0 " + radius + " lineto"; 32 | out += "\n" + "0 0 " + radius + " 90 180 arc"; 33 | out += "\n" + "0 0 lineto stroke"; 34 | 35 | // By default we show just the Sine Scale 36 | out += "\n" + "%% ================ Draw Sin Scale ================="; 37 | if (myAstrolabe.getGridPerDegree()){ 38 | // draw by degree 39 | for (int j = 1; j < 90; j++){ 40 | double angleR = Math.toRadians(j); 41 | double x = Math.sin(angleR)*radius; 42 | double y = Math.cos(angleR)*radius; 43 | out += "\n" + "newpath"; 44 | out += "\n" + "0 " + y + " moveto"; 45 | out += "\n" + -x + " " + y + " lineto stroke"; 46 | } 47 | // mark sine divisions 48 | double step = radius/60.0; 49 | int divisions = 60; 50 | if (myAstrolabe.getUse100()){ 51 | step = radius/50.0; 52 | divisions = 50; 53 | } 54 | for (i = 0; i <= divisions; i++) { 55 | if (i > 0 && i % 5 == 0 ){ 56 | myY = step * i; 57 | out += "\n" + "newpath"; 58 | out += "\n" + "0 " + myY + " moveto"; 59 | out += "\n" + "2 " + myY + " lineto stroke"; 60 | } 61 | } 62 | }else { 63 | double step = radius/60.0; 64 | int divisions = 60; 65 | if (myAstrolabe.getUse100()){ 66 | step = radius/50.0; 67 | divisions = 50; 68 | } 69 | 70 | for (i = 0; i <= divisions; i++) { 71 | myY = step * i; 72 | myX = Math.sqrt((radius * radius) - (myY * myY)); // from circle eq 73 | out += "\n" + "newpath"; 74 | if (i > 0 && i % 5 == 0 ){ 75 | out += "\n" + "[2 2] 0 setdash"; //dash every 5th line 76 | }else{ 77 | out += "\n" + "[] 0 setdash"; 78 | } 79 | out += "\n" + "0 " + myY + " moveto"; 80 | out += "\n" + -myX + " " + myY + " lineto stroke"; 81 | } 82 | } 83 | 84 | out += "\n" + "%% ================ Draw Cos Scale ================="; 85 | if (myAstrolabe.getShowCosine()) { 86 | if (myAstrolabe.getGridPerDegree()) { 87 | // draw by degree 88 | for (int j = 1; j < 90; j++) { 89 | double angleR = Math.toRadians(j); 90 | double x = Math.sin(angleR) * radius; 91 | double y = Math.cos(angleR) * radius; 92 | out += "\n" + "newpath"; 93 | out += "\n" + -x + " 0 moveto"; 94 | out += "\n" + -x + " " + y + " lineto stroke"; 95 | } 96 | // mark cosine divisions 97 | double step = radius/60.0; 98 | int divisions = 60; 99 | if (myAstrolabe.getUse100()){ 100 | step = radius/50.0; 101 | divisions = 50; 102 | } 103 | for (i = 0; i <= divisions; i++) { 104 | if (i > 0 && i % 5 == 0 ){ 105 | myX = step * i; 106 | out += "\n" + "newpath"; 107 | out += "\n" + -myX + " 0 moveto"; 108 | out += "\n" + -myX + " -2 lineto stroke"; 109 | } 110 | } 111 | } else { 112 | double step = radius/60.0; 113 | int divisions = 60; 114 | if (myAstrolabe.getUse100()){ 115 | step = radius/50.0; 116 | divisions = 50; 117 | } 118 | 119 | for (i = 0; i <= divisions; i++) { 120 | myX = step * i; 121 | myY = Math.sqrt((radius * radius) - (myX * myX)); // from circle eq 122 | out += "\n" + "newpath"; 123 | if (i > 0 && i % 5 == 0 ){ 124 | out += "\n" + "[2 2] 0 setdash"; //dash every 5th line 125 | }else{ 126 | out += "\n" + "[] 0 setdash"; 127 | } 128 | out += "\n" + -myX + " 0 moveto"; 129 | out += "\n" + -myX + " " + myY + " lineto stroke"; 130 | } 131 | } 132 | } 133 | out += "\n" + "[] 0 setdash"; 134 | 135 | out += "\n" + "%% ================ Draw Radials ================="; 136 | if (myAstrolabe.getShowRadials()) { 137 | for (int j = 1; j < 6; j++){ 138 | double angleR = Math.toRadians(j * 15.0); 139 | double x = Math.sin(angleR)*radius; 140 | double y = Math.cos(angleR)*radius; 141 | out += "\n" + "newpath"; 142 | out += "\n" + "0 0 moveto"; 143 | out += "\n" + -x + " " + y + " lineto stroke"; 144 | } 145 | } 146 | 147 | out += "\n" + "%% ================ Draw Arcs ================="; 148 | if (myAstrolabe.getShowArcs()) { 149 | for (int j = 1; j < 9; j++){ 150 | double angleR = Math.toRadians(j * 10.0); 151 | double r = Math.sin(angleR)*radius; 152 | out += "\n" + "newpath"; 153 | out += "\n" + "0 0 " + r + " 90 180 arc stroke"; 154 | } 155 | } 156 | 157 | out += "\n" + "%% ================ Draw Obliqity ================="; 158 | if (myAstrolabe.getShowObliqityArc()) { 159 | double obl = AstroMath.obliquity(AstroMath.getT()); 160 | double angleR = Math.toRadians(obl); 161 | double r = Math.sin(angleR)*radius; 162 | out += "\n" + "newpath"; 163 | out += "\n" + "[3 3] 0 setdash"; 164 | out += "\n" + "0 0 " + r + " 90 180 arc stroke"; 165 | out += "\n" + "[] 0 setdash"; 166 | } 167 | 168 | // todo: Need to add the scales to the axis 169 | out += "\n" + "%% ================ End Sin/Cos Scale ================="; 170 | 171 | return out; 172 | } 173 | 174 | 175 | public SineGrid(Astrolabe myAstrolabe) { 176 | this.myAstrolabe = myAstrolabe; 177 | } 178 | } 179 | -------------------------------------------------------------------------------- /src/main/java/com/wymarc/astrolabe/math/InterSect.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: AstrolabeGenerator.java,v 3.1 3 | *

4 | * The Astrolabe Generator is free software; you can redistribute it 5 | * and/or modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 3 of 7 | * the License, or(at your option) any later version. 8 | *

9 | * The Astrolabe Generator is distributed in the hope that it will be 10 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 11 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | *

14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *

18 | * Copyright (c) 2017 Timothy J. Mitchell 19 | */ 20 | package com.wymarc.astrolabe.math; 21 | 22 | /** 23 | * Given two circles defined by center and radius, this class will return the intersection 24 | * points and intersection angles 25 | * 26 | * @author Timothy J. Mitchell (wymarc@hotmail.com) (Modified from other sources-see below) 27 | * 28 | * link http://astrolabeproject.com 29 | * link http://www.astrolabes.org 30 | * 31 | * 32 | * version 3.0 33 | * 34 | * This is a mashup of the following two routines with some of my own additions: 35 | * Some code ported from C xsect routine by James Morrison published in The Astrolabe: page 378-380 36 | * Most code ported from C circle_circle_intersection routine by Tim Voght 37 | * And then the lot ported back to Java. 38 | */ 39 | public class InterSect { 40 | 41 | private double xi; 42 | private double yi; 43 | private double xi_prime; 44 | private double yi_prime; 45 | private double angle1; 46 | private double angle2; 47 | private Boolean intersection = false; 48 | 49 | public double getXi() { 50 | return xi; 51 | } 52 | 53 | public double getYi() { 54 | return yi; 55 | } 56 | 57 | public double getXi_prime() { 58 | return xi_prime; 59 | } 60 | 61 | public double getYi_prime() { 62 | return yi_prime; 63 | } 64 | 65 | public double getAngle1() { 66 | return Math.toDegrees(angle1); 67 | } 68 | 69 | public double getAngle2() { 70 | return Math.toDegrees(angle2); 71 | } 72 | 73 | public Boolean getIntersection() { 74 | return intersection; 75 | } 76 | 77 | private double polar ( double num, double den ){ 78 | // Polar Arctangent 79 | double ang = Math.atan2( num , den ); 80 | if (ang < 0.0) 81 | { 82 | ang = ang + 2.0 * Math.PI; 83 | } 84 | 85 | return ang; 86 | } 87 | 88 | /** 89 | * Computes Intersection of two circles 90 | * 91 | * @param x0 drawing circle center X 92 | * @param y0 drawing circle center Y 93 | * @param r0 drawing circle radius 94 | * 95 | * @param x1 clipping circle center X 96 | * @param y1 clipping circle center Y 97 | * @param r1 clipping circle radius 98 | * 99 | */ 100 | public InterSect(double x0, double y0, double r0, double x1, double y1, double r1) 101 | { 102 | double a; 103 | double dx; 104 | double dy; 105 | double d; 106 | double h; 107 | double rx; 108 | double ry; 109 | double x2; 110 | double y2; 111 | double A1; 112 | double A2; 113 | double xi1; 114 | double yi1; 115 | double xi_prime1; 116 | double yi_prime1; 117 | 118 | /* dx and dy are the vertical and horizontal distances between 119 | * the circle centers. 120 | */ 121 | dx = x1 - x0; 122 | dy = y1 - y0; 123 | 124 | /* Determine the straight-line distance between the centers. */ 125 | d = Math.sqrt((dy*dy) + (dx*dx)); 126 | //d = hypot(dx,dy); // Suggested by Keith Briggs 127 | 128 | /* Check for solvability. */ 129 | if (d > (r0 + r1)) 130 | { 131 | /* no solution. circles do not intersect. */ 132 | this.intersection = false; 133 | return; 134 | } 135 | if (d < Math.abs(r0 - r1)) 136 | { 137 | /* no solution. one circle is contained in the other */ 138 | this.intersection = false; 139 | return; 140 | } 141 | 142 | /* 'point 2' is the point where the line through the circle 143 | * intersection points crosses the line between the circle 144 | * centers. 145 | */ 146 | 147 | /* Determine the distance from point 0 to point 2. */ 148 | a = ((r0*r0) - (r1*r1) + (d*d)) / (2.0 * d) ; 149 | 150 | /* Determine the coordinates of point 2. */ 151 | x2 = x0 + (dx * a/d); 152 | y2 = y0 + (dy * a/d); 153 | 154 | /* Determine the distance from point 2 to either of the 155 | * intersection points. 156 | */ 157 | h = Math.sqrt((r0*r0) - (a*a)); 158 | 159 | /* Now determine the offsets of the intersection points from 160 | * point 2. 161 | */ 162 | rx = -dy * (h/d); 163 | ry = dx * (h/d); 164 | 165 | /* Determine the absolute intersection points. */ 166 | this.xi = x2 + rx; 167 | this.xi_prime = x2 - rx; 168 | this.yi = y2 + ry; 169 | this.yi_prime = y2 - ry; 170 | 171 | // Calculate intersection angles 172 | // first determine the intersections from the center of the circle to be drawn 173 | xi1 = this.xi-x0; 174 | xi_prime1 = this.xi_prime-x0; 175 | yi1 = this.yi-y0; 176 | yi_prime1 = this.yi_prime-y0; 177 | 178 | if ( xi1 != 0.0 ) 179 | { //Calculate first angle 180 | A1 = polar( yi1 , xi1) ; 181 | } 182 | else 183 | { 184 | if ( yi1 > 0.0 ) 185 | { 186 | A1 = (Math.PI/2.0); //x1 = 0 => a = 90 or 270 187 | } 188 | else 189 | { 190 | A1 = 3.0 * Math.PI / 2.0 ; 191 | } 192 | } 193 | 194 | if ( xi_prime1 != 0.0) 195 | {//Calculate second angle 196 | A2 = polar( yi_prime1 , xi_prime1 ) ; 197 | } 198 | else 199 | { 200 | if (yi_prime1 > 0.0) A2 = Math.PI / 2.0 ; 201 | else A2 = 3.0 * Math.PI / 2.0 ; 202 | } 203 | 204 | // Store returned values //TODO: WTF 205 | this.angle1 = A1; 206 | x1 = this.xi; 207 | y1 = this.yi; 208 | this.angle2 = A2; 209 | x2 = this.xi_prime; 210 | y2 = this.yi_prime; 211 | 212 | // Sort returned values 213 | if (this.angle1 > this.angle2) 214 | { 215 | //swap (angle1,angle2) ; 216 | double hold; 217 | hold = this.angle1; 218 | this.angle1=this.angle2; 219 | this.angle2=hold; 220 | //swap (x1,x2) ; 221 | hold = x1; 222 | x1=x2; 223 | x2=hold; 224 | //swap (y1,y2) ; 225 | hold = y1; 226 | y1=y2; 227 | y2=hold; 228 | } 229 | //System.out.println("Angle 1 = " + Math.toDegrees(angle1)); 230 | //System.out.println("Angle 2 = " + Math.toDegrees(angle2)); 231 | this.intersection = true; //Return shows there is an intersection 232 | } 233 | } 234 | 235 | 236 | 237 | -------------------------------------------------------------------------------- /src/main/resources/com/wymarc/astrolabe/generator/astrolabe_config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ${project.version} 5 | 6 | 7 | Pennsic War 8 | 405835N 0800809W 9 | 10 | 11 | 12 | Default Astrolabe 13 | true 14 | 0 15 | false 16 | true 17 | 0 18 | false 19 | true 20 | 0 21 | 2 22 | true 23 | true 24 | false 25 | 0 26 | false 27 | false 28 | false 29 | false 30 | false 31 | false 32 | false 33 | false 34 | false 35 | 1 36 | 1 37 | 1 38 | 3 39 | 0 40 | true 41 | false 42 | false 43 | 44 | 45 | Simplified Astrolabe 46 | true 47 | 0 48 | false 49 | true 50 | 0 51 | false 52 | true 53 | 0 54 | 3 55 | false 56 | false 57 | false 58 | 0 59 | false 60 | false 61 | false 62 | false 63 | false 64 | false 65 | false 66 | false 67 | false 68 | 0 69 | 0 70 | 0 71 | 0 72 | 1 73 | false 74 | false 75 | false 76 | 77 | 78 | Astrolabe for Basic Class 79 | true 80 | 0 81 | false 82 | true 83 | 0 84 | false 85 | true 86 | 0 87 | 2 88 | true 89 | true 90 | false 91 | 0 92 | false 93 | false 94 | false 95 | false 96 | false 97 | false 98 | false 99 | false 100 | false 101 | 1 102 | 1 103 | 1 104 | 3 105 | 0 106 | true 107 | false 108 | false 109 | 110 | 111 | Astrolabe for Advanced Class 112 | true 113 | 1 114 | false 115 | true 116 | 0 117 | false 118 | true 119 | 0 120 | 2 121 | true 122 | true 123 | true 124 | 0 125 | true 126 | true 127 | true 128 | true 129 | false 130 | false 131 | true 132 | true 133 | false 134 | 2 135 | 2 136 | 1 137 | 3 138 | 0 139 | true 140 | false 141 | false 142 | 143 | 144 | Modern Astrolabe 145 | true 146 | 0 147 | false 148 | true 149 | 0 150 | false 151 | true 152 | 0 153 | 2 154 | true 155 | true 156 | false 157 | 0 158 | false 159 | false 160 | false 161 | false 162 | false 163 | false 164 | false 165 | false 166 | false 167 | 0 168 | 0 169 | 0 170 | 0 171 | 2 172 | false 173 | true 174 | true 175 | 176 | 177 | 178 | 179 | 180 | 181 | Montreal 182 | 453000N 183 | 184 | 185 | New York 186 | 404200N 187 | 188 | 189 | Washington DC 190 | 385400N 191 | 192 | 193 | Dallas 194 | 324700N 195 | 196 | 197 | Mexico City 198 | 192600N 199 | 200 | 201 | 202 | 203 | 204 | 205 | -------------------------------------------------------------------------------- /src/main/java/com/wymarc/astrolabe/Location.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: AstrolabeGenerator.java,v 3.1 3 | *

4 | * The Astrolabe Generator is free software; you can redistribute it 5 | * and/or modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 3 of 7 | * the License, or(at your option) any later version. 8 | *

9 | * The Astrolabe Generator is distributed in the hope that it will be 10 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 11 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | *

14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *

18 | * Copyright (c) 2017 Timothy J. Mitchell 19 | */ 20 | package com.wymarc.astrolabe; 21 | 22 | /** 23 | * provides a object for describing locations 24 | */ 25 | public class Location 26 | { 27 | private double latitude; 28 | private double longitude; 29 | private String locationName; 30 | 31 | private int latDegrees; 32 | private int latMinutes; 33 | private int latSeconds; 34 | private String latHemisphere; 35 | private int lonDegrees; 36 | private int lonMinutes; 37 | private int lonSeconds; 38 | private String lonHemisphere; 39 | 40 | /** 41 | * constructor 42 | * 43 | * @param nameIn String Location name 44 | * @param lat double decimal latitude 45 | * @param lon double decimal longitude 46 | */ 47 | public Location(String nameIn,double lat,double lon){ 48 | latitude = lat; 49 | longitude = lon; 50 | 51 | if(nameIn == null){ 52 | locationName = ""; 53 | }else{ 54 | locationName = nameIn; 55 | } 56 | } 57 | 58 | /** 59 | * constructor 60 | * 61 | * @param nameIn String Location name 62 | * @param latDeg int latitude degrees 63 | * @param latMin int latitude minutes 64 | * @param latSec int latitude seconds 65 | * @param latDir String latitude direction (N/S) 66 | * @param lonDeg int longitude degrees 67 | * @param lonMin int longitude minutes 68 | * @param lonSec int longitude seconds 69 | * @param lonDir String longitude direction (N/S) 70 | */ 71 | public Location(String nameIn,int latDeg,int latMin,int latSec,String latDir, 72 | int lonDeg,int lonMin,int lonSec,String lonDir){ 73 | setLocation(nameIn, latDeg, latMin, latSec, latDir, lonDeg, lonMin, lonSec, lonDir); 74 | } 75 | 76 | public Location(){ 77 | latitude = 0.0; 78 | longitude = 0.0; 79 | locationName = ""; 80 | } 81 | 82 | public void setLocation(String nameIn,int latDeg,int latMin,int latSec,String latDir, 83 | int lonDeg,int lonMin,int lonSec,String lonDir){ 84 | latDegrees = latDeg; 85 | latMinutes = latMin; 86 | latSeconds = latSec; 87 | latHemisphere = latDir.toUpperCase(); 88 | lonDegrees = lonDeg; 89 | lonMinutes = lonMin; 90 | lonSeconds = lonSec; 91 | lonHemisphere = lonDir.toUpperCase(); 92 | 93 | 94 | latitude = (double)latDeg + ((double)latMin/60) + ((double)latSec/3600); 95 | longitude = (double)lonDeg + ((double)lonMin/60) + ((double)lonSec/3600); 96 | 97 | // Note: This current defaults to North and East 98 | if(latDir.toUpperCase().equals("S")){ 99 | latitude = -latitude; 100 | } 101 | if(lonDir.toUpperCase().equals("W")){ 102 | longitude = -longitude; 103 | } 104 | 105 | if(nameIn == null){ 106 | locationName = ""; 107 | }else{ 108 | locationName = nameIn; 109 | } 110 | } 111 | 112 | public void setLocation(String locationIn){ 113 | // assumes the location string has been tested for validity (format: ddmmssh dddmmssh) 114 | latDegrees = Integer.parseInt(locationIn.substring(0, 2)); 115 | latMinutes = Integer.parseInt(locationIn.substring(2, 4)); 116 | latSeconds = Integer.parseInt(locationIn.substring(4, 6)); 117 | latHemisphere = locationIn.substring(6,7); 118 | 119 | lonDegrees = Integer.parseInt(locationIn.substring(8, 11)); 120 | lonMinutes = Integer.parseInt(locationIn.substring(11, 13)); 121 | lonSeconds = Integer.parseInt(locationIn.substring(13, 15)); 122 | lonHemisphere = locationIn.substring(15,16); 123 | 124 | 125 | 126 | latitude = (double)latDegrees + ((double)latMinutes/60) + ((double)latSeconds/3600); 127 | longitude = (double)lonDegrees + ((double)lonMinutes/60) + ((double)lonSeconds/3600); 128 | 129 | // Note: This current defaults to North and East 130 | if(latHemisphere.toUpperCase().equals("S")) { 131 | latitude = -latitude; 132 | } 133 | if(lonHemisphere.toUpperCase().equals("W")){ 134 | longitude = -longitude; 135 | } 136 | } 137 | 138 | public void setLocationName(String nameIn){ 139 | locationName = nameIn; 140 | } 141 | 142 | public Double getLatitude() { 143 | return latitude; 144 | } 145 | 146 | public Double getLongitude() { 147 | return longitude; 148 | } 149 | 150 | public String getLocationName() { 151 | return locationName; 152 | } 153 | 154 | public String getDisplayString(){ 155 | return convertLatitudeToString(latitude) + ' ' + convertLongitudeToString(longitude); 156 | } 157 | 158 | private String convertLatitudeToString(double latIn){ 159 | String direction = "N"; 160 | if(latIn < 0){ 161 | direction = "S"; 162 | } 163 | return convertToDMS(latIn) + direction; 164 | } 165 | 166 | private String convertLongitudeToString(double lonIn){ 167 | String direction = "E"; 168 | if(lonIn < 0){ 169 | direction = "W"; 170 | } 171 | String lon = convertToDMS(lonIn) + direction; 172 | if (lon.length() < 7){ //1202020W 173 | lon = "00" + lon; 174 | }else if (lon.length() < 8){ 175 | lon = "0" + lon; 176 | } 177 | return lon; 178 | } 179 | 180 | private String convertToDMS(double d){ 181 | String deg = ""; 182 | String min = ""; 183 | String sec = ""; 184 | 185 | d = Math.abs(d); 186 | 187 | //degrees 188 | Integer i = (int)Math.floor(d); 189 | if (i < 10){ 190 | deg = "0"; 191 | } 192 | deg = deg + i; 193 | 194 | //minutes 195 | d = d - i; 196 | d = d * 60; 197 | i = (int)Math.floor(d); 198 | if (i < 10){ 199 | min = "0"; 200 | } 201 | min = min + i; 202 | 203 | //seconds 204 | d = d - i; 205 | d = d * 60; 206 | i = (int)Math.floor(d); 207 | if (i < 10){ 208 | sec = "0"; 209 | } 210 | sec = sec + i; 211 | 212 | return deg + min + sec; 213 | } 214 | 215 | public static boolean isValidLocation(String locationIn){ 216 | String regex = "([0-8][0-9]|[9][0])([0-5][0-9]|[6][0])([0-5][0-9]|[6][0])[NS] ([0][0-9][0-9]|[0-1][0-8][0-9]|[1][8][0])([0-5][0-9]|[6][0])([0-5][0-9]|[6][0])[EW]"; 217 | // first check format 218 | if (!locationIn.matches(regex)){ 219 | return false; 220 | } 221 | // the regex does no filter out locations like: 904545N 1804545E so parse and test 222 | // from the regex we know the format is ddmmssh dddmmssh 223 | int latDeg = Integer.parseInt(locationIn.substring(0, 2)); 224 | int latMin = Integer.parseInt(locationIn.substring(2, 4)); 225 | int latSec = Integer.parseInt(locationIn.substring(4, 6)); 226 | 227 | int lonDeg = Integer.parseInt(locationIn.substring(8, 11)); 228 | int lonMin = Integer.parseInt(locationIn.substring(11, 13)); 229 | int lonSec = Integer.parseInt(locationIn.substring(13,15)); 230 | 231 | if ((latDeg == 90) && (latMin > 0 || latSec > 0) ){ 232 | return false; 233 | } 234 | 235 | return !((lonDeg == 180) && (lonMin > 0 || lonSec > 0)); 236 | } 237 | 238 | public int getLatDeg(){ 239 | return latDegrees; 240 | } 241 | 242 | public int getLatMin(){ 243 | return latMinutes; 244 | } 245 | 246 | public int getLatSec(){ 247 | return latSeconds; 248 | } 249 | 250 | public String getLatDir(){ 251 | return latHemisphere; 252 | } 253 | 254 | public int getLonDeg(){ 255 | return lonDegrees; 256 | } 257 | 258 | public int getLonMin(){ 259 | return lonMinutes; 260 | } 261 | 262 | public int getLonSec(){ 263 | return lonSeconds; 264 | } 265 | 266 | public String getLonDir(){ 267 | return lonHemisphere; 268 | } 269 | 270 | } 271 | 272 | -------------------------------------------------------------------------------- /src/main/java/com/wymarc/astrolabe/generator/gui/tabbedview/ExtrasPanel.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: AstrolabeGenerator.java,v 3.1 3 | *

4 | * The Astrolabe Generator is free software; you can redistribute it 5 | * and/or modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 3 of 7 | * the License, or(at your option) any later version. 8 | *

9 | * The Astrolabe Generator is distributed in the hope that it will be 10 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 11 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | *

14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *

18 | * Copyright (c) 2017 Timothy J. Mitchell 19 | */ 20 | package com.wymarc.astrolabe.generator.gui.tabbedview; 21 | 22 | import com.wymarc.astrolabe.generator.AstrolabeGenerator; 23 | import com.wymarc.astrolabe.generator.gui.GeneratorGui; 24 | 25 | import javax.swing.*; 26 | 27 | import java.awt.*; 28 | import java.awt.event.ActionEvent; 29 | import java.awt.event.ActionListener; 30 | import java.awt.event.MouseEvent; 31 | import java.awt.event.MouseListener; 32 | 33 | public class ExtrasPanel extends JPanel implements ActionListener,MouseListener { 34 | private JCheckBox tenAlidadeCheck = null; 35 | private JCheckBox tenRuleCheck = null; 36 | private JCheckBox counterChangedCheck = null; 37 | 38 | public ExtrasPanel() { 39 | super(); 40 | setLayout(new BorderLayout()); 41 | 42 | JPanel leftPanel = new JPanel(); 43 | leftPanel.setLayout(new BorderLayout()); 44 | 45 | JPanel optionsPanel = new JPanel(); 46 | optionsPanel.setLayout(new GridBagLayout()); 47 | 48 | JLabel optionsLabel = new JLabel("Multi-piece sheets (handy for making a lot of astrolabes):"); 49 | GridBagConstraints c = new GridBagConstraints(); 50 | c.fill = GridBagConstraints.HORIZONTAL; 51 | c.insets = new Insets(5,10,5,5); 52 | c.gridx = 0; 53 | c.gridy = 0; 54 | optionsPanel.add(optionsLabel,c); 55 | c.gridy++; 56 | optionsPanel.add(getTenAlidadeCheck(),c); 57 | c.gridy++; 58 | optionsPanel.add(getTenRuleCheck(),c); 59 | c.gridy++; 60 | optionsPanel.add(getCounterChangedCheck(),c); 61 | 62 | //todo 63 | // if (null != getClimateSetCheckboxes() && getClimateSetCheckboxes().size() > 0){ 64 | // c.gridy++; 65 | // optionsPanel.add( new JSeparator(JSeparator.HORIZONTAL),c); 66 | // c.gridy++; 67 | // JLabel climateLabel = new JLabel("Climate plate sets (Interchangeable plates for major cities):"); 68 | // optionsPanel.add(climateLabel,c); 69 | // c.gridy++; 70 | // JLabel climateLabel1 = new JLabel("(Plates will use the settings from the Front Tab)"); 71 | // optionsPanel.add(climateLabel1,c); 72 | // for (JCheckBox ck : GeneratorGui.MY_ASTROLABE.getClimateSetCheckboxes()){ 73 | // c.gridy++; 74 | // optionsPanel.add(ck,c); 75 | // } 76 | // } 77 | 78 | leftPanel.add(optionsPanel, BorderLayout.NORTH); 79 | add(leftPanel, BorderLayout.WEST); 80 | 81 | ImageIcon icon = createImageIcon("gui/images/misc/rulesthumb.png"); 82 | JLabel iconLabel = new JLabel(icon); 83 | if (null != icon){ 84 | iconLabel.setBounds(0, 0, icon.getIconWidth(), icon.getIconHeight()); 85 | } 86 | add(iconLabel,BorderLayout.EAST); 87 | } 88 | 89 | /** Returns an ImageIcon, or null if the path was invalid. */ 90 | private ImageIcon createImageIcon(String path) { 91 | java.net.URL imgURL = AstrolabeGenerator.class.getResource(path); 92 | if (imgURL != null) { 93 | return new ImageIcon(imgURL); 94 | } else { 95 | System.err.println("Couldn't find file: " + path); 96 | return null; 97 | } 98 | } 99 | 100 | private JCheckBox getTenAlidadeCheck(){ 101 | if (null == tenAlidadeCheck){ 102 | tenAlidadeCheck = new JCheckBox("10 alidade sheet"); 103 | tenAlidadeCheck.setSelected(GeneratorGui.MY_ASTROLABE.getPrintAlidadeSheet()); 104 | tenAlidadeCheck.setToolTipText("Include a ten alidade sheet"); 105 | tenAlidadeCheck.setActionCommand("Alidade"); 106 | tenAlidadeCheck.addActionListener(this); 107 | tenAlidadeCheck.addMouseListener(this); 108 | } 109 | return tenAlidadeCheck; 110 | } 111 | 112 | private JCheckBox getTenRuleCheck(){ 113 | if (null == tenRuleCheck){ 114 | tenRuleCheck = new JCheckBox("10 rule sheet"); 115 | tenRuleCheck.setSelected(GeneratorGui.MY_ASTROLABE.getPrintRuleSheet()); 116 | tenRuleCheck.setToolTipText("Include a ten rule sheet"); 117 | tenRuleCheck.setActionCommand("Rule"); 118 | tenRuleCheck.addActionListener(this); 119 | tenRuleCheck.addMouseListener(this); 120 | } 121 | return tenRuleCheck; 122 | } 123 | 124 | private JCheckBox getCounterChangedCheck(){ 125 | if (null == counterChangedCheck){ 126 | counterChangedCheck = new JCheckBox("Counterchange alidades"); 127 | counterChangedCheck.setSelected(GeneratorGui.MY_ASTROLABE.isCounterChanged()); 128 | counterChangedCheck.setToolTipText("Counterchange the offset of the arms"); 129 | counterChangedCheck.setActionCommand("Counterchange"); 130 | counterChangedCheck.addActionListener(this); 131 | counterChangedCheck.addMouseListener(this); 132 | } 133 | return counterChangedCheck; 134 | } 135 | 136 | // todo 137 | // private List getClimateSetCheckboxes(){ 138 | // if (null == GeneratorGui.MY_ASTROLABE.getClimateSetCheckboxes()){ 139 | // List climateSetCheckboxes = new ArrayList(); 140 | // List climateSets = GeneratorGui.MY_CONFIG.getClimateSets(); 141 | // for (ClimateSet set : climateSets){ 142 | // JCheckBox temp = new JCheckBox(set.getName()); 143 | // //temp.setSelected(GeneratorGui.MY_ASTROLABE.isCounterChanged()); 144 | // temp.setToolTipText(set.getLocationNames()); 145 | // climateSetCheckboxes.add(temp); 146 | // } 147 | // GeneratorGui.MY_ASTROLABE.setClimateSetCheckboxes(climateSetCheckboxes); 148 | // } 149 | // return GeneratorGui.MY_ASTROLABE.getClimateSetCheckboxes(); 150 | // } 151 | 152 | 153 | public void actionPerformed(ActionEvent e) { 154 | String cmd = e.getActionCommand(); 155 | 156 | if (cmd.equals("Alidade")) { 157 | GeneratorGui.MY_ASTROLABE.setPrintAlidadeSheet(tenAlidadeCheck.isSelected()); 158 | } 159 | 160 | if (cmd.equals("Rule")) { 161 | GeneratorGui.MY_ASTROLABE.setPrintRuleSheet(tenRuleCheck.isSelected()); 162 | } 163 | 164 | if (cmd.equals("Counterchange")) { 165 | GeneratorGui.MY_ASTROLABE.setCounterChanged(counterChangedCheck.isSelected()); 166 | } 167 | } 168 | 169 | public void mouseClicked(MouseEvent e) { 170 | 171 | } 172 | 173 | public void mousePressed(MouseEvent e) { 174 | 175 | } 176 | 177 | public void mouseReleased(MouseEvent e) { 178 | 179 | } 180 | 181 | public void mouseEntered(MouseEvent e) { 182 | String text = ""; 183 | Object obj = e.getSource(); 184 | if (obj instanceof JComboBox){ 185 | text = ((JComboBox) obj).getToolTipText(); 186 | }else if (obj instanceof JCheckBox){ 187 | text = ((JCheckBox) obj).getToolTipText(); 188 | } 189 | 190 | GeneratorGui.setStatusLabel(text); 191 | } 192 | 193 | public void mouseExited(MouseEvent e) { 194 | GeneratorGui.setStatusLabel(""); 195 | } 196 | } 197 | -------------------------------------------------------------------------------- /src/main/java/com/wymarc/astrolabe/generator/printengines/postscript/extras/Dastur.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: AstrolabeGenerator.java,v 3.1 3 | *

4 | * The Astrolabe Generator is free software; you can redistribute it 5 | * and/or modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 3 of 7 | * the License, or(at your option) any later version. 8 | *

9 | * The Astrolabe Generator is distributed in the hope that it will be 10 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 11 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | *

14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *

18 | * Copyright (c) 2017 Timothy J. Mitchell 19 | */ 20 | package com.wymarc.astrolabe.generator.printengines.postscript.extras; 21 | 22 | import com.wymarc.astrolabe.generator.printengines.postscript.util.EPSToolKit; 23 | 24 | /** 25 | * This Plugin will calculate the lines of a dastur and 26 | * print the results to an Encapsulated PostScript (EPS) file. Note that 27 | * This file is static with no inputs. Software is included for reference. 28 | *

29 | * link http://astrolabeproject.com.com 30 | * link http://www.astrolabes.org 31 | */ 32 | 33 | public class Dastur { 34 | 35 | public String createDastur() { 36 | StringBuilder out = new StringBuilder(); 37 | 38 | int count = 0; 39 | int Ri = 0; 40 | 41 | // Write header to file 42 | out.append("%!PS-Adobe-3.0 EPSF-30.") 43 | .append("\n").append("%%BoundingBox: 0 0 612 792") 44 | .append("\n").append("%%Title: Dastur") 45 | .append("\n").append("%%Creator: Richard Wymarc") 46 | .append("\n").append("%%CreationDate: ") 47 | .append("\n").append("%%EndComments"); 48 | 49 | out.append(EPSToolKit.setUpFonts()); 50 | 51 | out.append("\n").append("mark") 52 | .append("\n").append("/Dastur 10 dict def %local variable dictionary") 53 | .append("\n").append("Dastur begin") 54 | .append("\n").append("") 55 | .append("\n").append("%% setup") 56 | .append(EPSToolKit.fillBackground()) 57 | .append("\n").append("135 425 translate") 58 | .append("\n").append(".4 setlinewidth") 59 | .append("\n").append("") 60 | .append("\n").append("gsave") 61 | .append("\n").append(""); 62 | 63 | // define box 64 | out.append("\n").append("/boxpath") 65 | .append("\n").append("{ newpath") 66 | .append("\n").append("0 324 moveto") 67 | .append("\n").append("0 -324 lineto") 68 | .append("\n").append("324 -324 lineto") 69 | .append("\n").append("324 324 lineto") 70 | .append("\n").append("0 324 lineto") 71 | .append("\n").append("closepath } def"); 72 | 73 | // define 1/2 degree box 74 | out.append("\n").append("/boxpathhalfdegree") 75 | .append("\n").append("{ newpath") 76 | .append("\n").append("0 320 moveto") 77 | .append("\n").append("0 -320 lineto") 78 | .append("\n").append("320 -320 lineto") 79 | .append("\n").append("320 320 lineto") 80 | .append("\n").append("0 320 lineto") 81 | .append("\n").append("closepath } def"); 82 | 83 | // define degree box 84 | out.append("\n").append("/boxpathdegree") 85 | .append("\n").append("{ newpath") 86 | .append("\n").append("0 315 moveto") 87 | .append("\n").append("0 -315 lineto") 88 | .append("\n").append("315 -315 lineto") 89 | .append("\n").append("315 315 lineto") 90 | .append("\n").append("0 315 lineto") 91 | .append("\n").append("closepath } def"); 92 | 93 | // set up clipping path 94 | out.append("\n").append("boxpath clip"); 95 | 96 | // create 1/2 degree marks 97 | for (count = 1; count <= 540; count++) { 98 | out.append("\n").append("0 0 moveto") 99 | .append("\n").append("0 500 lineto stroke") 100 | .append("\n").append("-.25 rotate"); 101 | } 102 | out.append("\n").append("135 rotate") 103 | .append("\n").append("1 setgray") 104 | .append("\n").append("boxpathhalfdegree fill") 105 | .append("\n").append("0 setgray"); 106 | 107 | // create 1 degree marks 108 | for (count = 1; count <= 270; count++) { 109 | out.append("\n").append("0 0 moveto") 110 | .append("\n").append("0 500 lineto stroke") 111 | .append("\n").append("-.5 rotate"); 112 | } 113 | out.append("\n").append("135 rotate") 114 | .append("\n").append("1 setgray") 115 | .append("\n").append("boxpathdegree fill") 116 | .append("\n").append("0 setgray"); 117 | 118 | // create 5 degree marks 119 | for (count = 1; count <= 54; count++) { 120 | out.append("\n").append("0 0 moveto") 121 | .append("\n").append("0 500 lineto stroke") 122 | .append("\n").append("-2.5 rotate"); 123 | } 124 | out.append("\n").append("135 rotate") 125 | .append("\n").append("1 setgray") 126 | .append("\n").append("0 0 290 0 360 arc fill") 127 | .append("\n").append("0 setgray"); 128 | 129 | // create 10 degree marks 130 | for (count = 1; count <= 28; count++) { 131 | out.append("\n").append("0 0 moveto") 132 | .append("\n").append("0 500 lineto stroke") 133 | .append("\n").append("-5 rotate"); 134 | } 135 | out.append("\n").append("135 rotate") 136 | .append("\n").append("1 setgray") 137 | .append("\n").append("0 0 80 0 360 arc fill") 138 | .append("\n").append("0 setgray"); 139 | 140 | out.append("\n").append("grestore") 141 | .append("\n").append("gsave"); 142 | 143 | // horiz line 144 | out.append("\n").append("newpath") 145 | .append("\n").append("0 0 moveto") 146 | .append("\n").append("324 0 lineto stroke"); 147 | 148 | out.append("\n").append("grestore") 149 | .append("\n").append(""); 150 | 151 | // draw Box 152 | out.append("\n").append("% draw box outline") 153 | .append("\n").append("boxpath stroke") 154 | .append("\n").append(""); 155 | 156 | // Label 157 | out.append("\n").append("gsave") 158 | .append("\n").append("%% Label"); 159 | for (count = 0; count <= 9; count++) { 160 | out.append("\n").append("newpath") 161 | .append("\n").append("NormalFont10 setfont") 162 | .append("\n 290 1 moveto") 163 | .append("\n").append("(").append(count * 10).append(") show") 164 | .append("\n").append("") 165 | .append("\n").append("-5 rotate"); 166 | } 167 | out.append("\n").append("grestore"); 168 | 169 | out.append("\n").append("gsave") 170 | .append("\n").append("%% Label"); 171 | for (count = 1; count <= 17; count++) { 172 | out.append("\n").append("5 rotate") 173 | .append("\n").append("newpath") 174 | .append("\n").append("NormalFont10 setfont") 175 | .append("\n 290 1 moveto") 176 | .append("\n").append("(").append(count * 10).append(") show") 177 | .append("\n").append(""); 178 | } 179 | out.append("\n").append("grestore"); 180 | 181 | // Write Footer 182 | out.append("\n").append("% Eject the page") 183 | .append("\n").append("end cleartomark") 184 | .append("\n").append("showpage"); 185 | 186 | return out.toString(); 187 | 188 | } 189 | } -------------------------------------------------------------------------------- /src/main/java/com/wymarc/astrolabe/generator/config/AstrolabeExample.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: AstrolabeGenerator.java,v 3.1 3 | *

4 | * The Astrolabe Generator is free software; you can redistribute it 5 | * and/or modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 3 of 7 | * the License, or(at your option) any later version. 8 | *

9 | * The Astrolabe Generator is distributed in the hope that it will be 10 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 11 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | *

14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *

18 | * Copyright (c) 2017 Timothy J. Mitchell 19 | */ 20 | package com.wymarc.astrolabe.generator.config; 21 | 22 | public class AstrolabeExample { 23 | private String name; 24 | private boolean showThrone; 25 | private int shapeOption; 26 | private boolean zodiacSymbols; 27 | private boolean showRegistration; 28 | private int printOption; 29 | private boolean showHorizonPlate; 30 | private boolean printTimeCorrection; 31 | private int hourMarkings; 32 | private boolean showCosine; 33 | private boolean use100; 34 | private boolean gridPerDegree; 35 | private boolean showRadials; 36 | private boolean showArcs; 37 | private boolean showObliqityArc; 38 | private int almucantarInterval; 39 | private boolean showAzimuth; 40 | private boolean showTwilight; 41 | private boolean showAllTwilight; 42 | private int degreeScaleType; 43 | private boolean showUnequalHours; 44 | private boolean showHouses; 45 | private boolean showMansions; 46 | private int backTopLeft; 47 | private int backTopRight; 48 | private int backBottomLeft; 49 | private int backBottomRight; 50 | private int reteType; 51 | private boolean showCotangent; 52 | private boolean concentricCalendar; 53 | private boolean showEot; 54 | 55 | public String getName() { 56 | return name; 57 | } 58 | 59 | public void setName(String name) { 60 | this.name = name; 61 | } 62 | 63 | public boolean isShowThrone() { 64 | return showThrone; 65 | } 66 | 67 | public void setShowThrone(boolean showThrone) { 68 | this.showThrone = showThrone; 69 | } 70 | 71 | public int getShapeOption() { 72 | return shapeOption; 73 | } 74 | 75 | public void setShapeOption(int shapeOption) { 76 | this.shapeOption = shapeOption; 77 | } 78 | 79 | public boolean isZodiacSymbols() { 80 | return zodiacSymbols; 81 | } 82 | 83 | public void setZodiacSymbols(boolean zodiacSymbols) { 84 | this.zodiacSymbols = zodiacSymbols; 85 | } 86 | 87 | public boolean isShowRegistration() { 88 | return showRegistration; 89 | } 90 | 91 | public void setShowRegistration(boolean showRegistration) { 92 | this.showRegistration = showRegistration; 93 | } 94 | 95 | public int getPrintOption() { 96 | return printOption; 97 | } 98 | 99 | public void setPrintOption(int printOption) { 100 | this.printOption = printOption; 101 | } 102 | 103 | public boolean isShowHorizonPlate() { 104 | return showHorizonPlate; 105 | } 106 | 107 | public void setShowHorizonPlate(boolean showHorizonPlate) { 108 | this.showHorizonPlate = showHorizonPlate; 109 | } 110 | 111 | public boolean isPrintTimeCorrection() { 112 | return printTimeCorrection; 113 | } 114 | 115 | public void setPrintTimeCorrection(boolean printTimeCorrection) { 116 | this.printTimeCorrection = printTimeCorrection; 117 | } 118 | 119 | public int getHourMarkings() { 120 | return hourMarkings; 121 | } 122 | 123 | public void setHourMarkings(int hourMarkings) { 124 | this.hourMarkings = hourMarkings; 125 | } 126 | 127 | public boolean isShowCosine() { 128 | return showCosine; 129 | } 130 | 131 | public void setShowCosine(boolean showCosine) { 132 | this.showCosine = showCosine; 133 | } 134 | 135 | public boolean isUse100() { 136 | return use100; 137 | } 138 | 139 | public void setUse100(boolean use100) { 140 | this.use100 = use100; 141 | } 142 | 143 | public boolean isGridPerDegree() { 144 | return gridPerDegree; 145 | } 146 | 147 | public void setGridPerDegree(boolean gridPerDegree) { 148 | this.gridPerDegree = gridPerDegree; 149 | } 150 | 151 | public boolean isShowRadials() { 152 | return showRadials; 153 | } 154 | 155 | public void setShowRadials(boolean showRadials) { 156 | this.showRadials = showRadials; 157 | } 158 | 159 | public boolean isShowArcs() { 160 | return showArcs; 161 | } 162 | 163 | public void setShowArcs(boolean showArcs) { 164 | this.showArcs = showArcs; 165 | } 166 | 167 | public boolean isShowObliqityArc() { 168 | return showObliqityArc; 169 | } 170 | 171 | public void setShowObliqityArc(boolean showObliqityArc) { 172 | this.showObliqityArc = showObliqityArc; 173 | } 174 | 175 | public int getAlmucantarInterval() { 176 | return almucantarInterval; 177 | } 178 | 179 | public void setAlmucantarInterval(int almucantarInterval) { 180 | this.almucantarInterval = almucantarInterval; 181 | } 182 | 183 | public boolean isShowAzimuth() { 184 | return showAzimuth; 185 | } 186 | 187 | public void setShowAzimuth(boolean showAzimuth) { 188 | this.showAzimuth = showAzimuth; 189 | } 190 | 191 | public boolean isShowTwilight() { 192 | return showTwilight; 193 | } 194 | 195 | public void setShowTwilight(boolean showTwilight) { 196 | this.showTwilight = showTwilight; 197 | } 198 | 199 | public boolean isShowAllTwilight() { 200 | return showAllTwilight; 201 | } 202 | 203 | public void setShowAllTwilight(boolean showAllTwilight) { 204 | this.showAllTwilight = showAllTwilight; 205 | } 206 | 207 | public int getDegreeScaleType() { 208 | return degreeScaleType; 209 | } 210 | 211 | public void setDegreeScaleType(int degreeScaleType) { 212 | this.degreeScaleType = degreeScaleType; 213 | } 214 | 215 | public boolean isShowUnequalHours() { 216 | return showUnequalHours; 217 | } 218 | 219 | public void setShowUnequalHours(boolean showUnequalHours) { 220 | this.showUnequalHours = showUnequalHours; 221 | } 222 | 223 | public boolean isShowHouses() { 224 | return showHouses; 225 | } 226 | 227 | public void setShowHouses(boolean showHouses) { 228 | this.showHouses = showHouses; 229 | } 230 | 231 | public boolean isShowMansions() { 232 | return showMansions; 233 | } 234 | 235 | public void setShowMansions(boolean showMansions) { 236 | this.showMansions = showMansions; 237 | } 238 | 239 | public int getBackTopLeft() { 240 | return backTopLeft; 241 | } 242 | 243 | public void setBackTopLeft(int backTopLeft) { 244 | this.backTopLeft = backTopLeft; 245 | } 246 | 247 | public int getBackTopRight() { 248 | return backTopRight; 249 | } 250 | 251 | public void setBackTopRight(int backTopRight) { 252 | this.backTopRight = backTopRight; 253 | } 254 | 255 | public int getBackBottomLeft() { 256 | return backBottomLeft; 257 | } 258 | 259 | public void setBackBottomLeft(int backBottomLeft) { 260 | this.backBottomLeft = backBottomLeft; 261 | } 262 | 263 | public int getBackBottomRight() { 264 | return backBottomRight; 265 | } 266 | 267 | public void setBackBottomRight(int backBottomRight) { 268 | this.backBottomRight = backBottomRight; 269 | } 270 | 271 | public int getReteType() { 272 | return reteType; 273 | } 274 | 275 | public void setReteType(int type) { 276 | this.reteType = type; 277 | } 278 | 279 | public boolean isShowCotangent() { 280 | return showCotangent; 281 | } 282 | 283 | public void setShowCotangent(boolean showCotangent) { 284 | this.showCotangent = showCotangent; 285 | } 286 | 287 | public boolean isShowConcentricCalendar() { 288 | return concentricCalendar; 289 | } 290 | 291 | public void setShowConcentricCalendar(boolean concentricCalendar) { 292 | this.concentricCalendar = concentricCalendar; 293 | } 294 | 295 | public boolean isShowEot() { 296 | return showEot; 297 | } 298 | 299 | public void setShowEot(boolean showEot) { 300 | this.showEot = showEot; 301 | } 302 | } 303 | 304 | -------------------------------------------------------------------------------- /src/main/java/com/wymarc/astrolabe/generator/io/FileHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: AstrolabeGenerator.java,v 3.1 3 | *

4 | * The Astrolabe Generator is free software; you can redistribute it 5 | * and/or modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 3 of 7 | * the License, or(at your option) any later version. 8 | *

9 | * The Astrolabe Generator is distributed in the hope that it will be 10 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 11 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | *

14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *

18 | * Copyright (c) 2017 Timothy J. Mitchell 19 | */ 20 | package com.wymarc.astrolabe.generator.io; 21 | 22 | import com.wymarc.astrolabe.Astrolabe; 23 | import com.wymarc.astrolabe.generator.gui.GeneratorGui; 24 | 25 | import javax.swing.*; 26 | import java.io.*; 27 | import java.nio.charset.Charset; 28 | import java.util.zip.ZipEntry; 29 | import java.util.zip.ZipOutputStream; 30 | 31 | public class FileHandler { 32 | 33 | public static Astrolabe openAstrolabeFile(){ //todo save and open not implemented yet 34 | Astrolabe savedAstrolabe = new Astrolabe(); 35 | 36 | return savedAstrolabe; 37 | } 38 | 39 | public static boolean saveAstrolabe(Astrolabe myAstrolabe){ //todo save and open not implemented yet 40 | boolean success = true; 41 | 42 | // get settings 43 | String userName = myAstrolabe.getUserName(); 44 | String locationName = myAstrolabe.getLocation().getLocationName(); 45 | double latitude = myAstrolabe.getLocation().getLatitude(); 46 | double longitude = myAstrolabe.getLocation().getLongitude(); 47 | int degreeInterval = myAstrolabe.getDegreeInterval(); 48 | int azimuthInterval = myAstrolabe.getAzimuthInterval(); 49 | int almucanterInterval = myAstrolabe.getAlmucanterInterval(); 50 | int degreeScaleType = myAstrolabe.getDegreeScaleType(); 51 | boolean showAzimuthLines = myAstrolabe.getShowAzimuthLines(); 52 | boolean showTwilightLines = myAstrolabe.getShowTwilightLines(); 53 | boolean showHousesofHeavenLines = myAstrolabe.getShowHousesofHeavenLines(); 54 | boolean showUnequalHoursLines = myAstrolabe.getShowUnequalHoursLines(); 55 | boolean showThrone = myAstrolabe.getShowThrone(); 56 | int shapeOption = myAstrolabe.getShapeOption(); 57 | boolean zodiacSymbols = myAstrolabe.getShowZodiacSymbols(); 58 | int hourMarkings = myAstrolabe.getHourMarkings(); 59 | boolean showRegistrationMarks = myAstrolabe.getShowRegistrationMarks(); 60 | boolean showTimeCorrection = myAstrolabe.getShowTimeCorrection(); 61 | boolean showCotangentScale = myAstrolabe.getShowCotangentScale(); 62 | boolean showLunarMansions = myAstrolabe.getShowLunarMansions(); 63 | int frontPrintOption = myAstrolabe.getFrontPrintOption(); 64 | boolean showHorizonPlate = myAstrolabe.getShowHorizonPlate(); 65 | int reteType = 0; 66 | int topLeft = myAstrolabe.getTopLeft(); 67 | int topRight = myAstrolabe.getTopRight(); 68 | int bottomLeft = myAstrolabe.getBottomLeft(); 69 | int bottomRight = myAstrolabe.getBottomRight(); 70 | boolean counterChanged = myAstrolabe.isCounterChanged(); 71 | 72 | return success; 73 | } 74 | 75 | /** 76 | * Saves the Astrolabe_assembly.pdf to the local machine 77 | * @return success or failure 78 | */ 79 | public static boolean saveInstructable(){ 80 | boolean success; 81 | 82 | String filePath = getSavePath(); 83 | GeneratorGui.MY_ASTROLABE.setFilePath(filePath); 84 | 85 | try{ 86 | InputStream in = FileHandler.class.getResourceAsStream("/com/wymarc/astrolabe/generator/reference/Astrolabe_assembly.pdf"); 87 | OutputStream out = new FileOutputStream(filePath + "/Astrolabe_assembly.pdf"); 88 | byte[] buffer = new byte[1024]; 89 | int len = in.read(buffer); 90 | while (len != -1) { 91 | out.write(buffer, 0, len); 92 | len = in.read(buffer); 93 | } 94 | out.close(); 95 | JOptionPane.showMessageDialog(null, "File saved to:\n" + filePath); 96 | success = true; 97 | }catch (Exception e){ 98 | JOptionPane.showMessageDialog(null,"There was a problem saving the file","Save Error",JOptionPane.ERROR_MESSAGE); 99 | success = false; 100 | } 101 | return success; 102 | } 103 | 104 | /** 105 | * Pops up a dialog to allow the user to choose where to save files 106 | * @return The path to the desired folder 107 | */ 108 | public static String getSavePath(){ 109 | JFileChooser chooser = new JFileChooser(); 110 | if (null == GeneratorGui.MY_ASTROLABE.getFilePath()){ 111 | chooser.setCurrentDirectory(new java.io.File(System.getProperty("user.dir"))); 112 | }else{ 113 | chooser.setCurrentDirectory(new java.io.File(GeneratorGui.MY_ASTROLABE.getFilePath())); 114 | } 115 | chooser.setDialogTitle("Select location to save to"); 116 | chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); 117 | 118 | // disable the "All files" option. 119 | chooser.setAcceptAllFileFilterUsed(false); 120 | chooser.setApproveButtonText("Select"); 121 | // Set the mnemonic 122 | chooser.setApproveButtonMnemonic('s'); 123 | // Set the tool tip 124 | chooser.setApproveButtonToolTipText("Save here"); 125 | 126 | if (chooser.showOpenDialog(null) != JFileChooser.APPROVE_OPTION) { 127 | return null; 128 | } 129 | 130 | String filePath = chooser.getSelectedFile().getPath(); 131 | Boolean noProblems = setFilePath(filePath); 132 | 133 | if (noProblems){ 134 | GeneratorGui.MY_ASTROLABE.setFilePath(filePath); 135 | return filePath; 136 | } 137 | 138 | return null; 139 | } 140 | 141 | /** 142 | * Tests for the existance of the traget folder, attempts to create it if it does not exist 143 | * @param filePathIn The path to the desired folder 144 | * @return True if a legal path, false otherwise 145 | */ 146 | private static Boolean setFilePath(String filePathIn) { 147 | // first check to see if the path exists if not create it 148 | File path = new File(filePathIn); 149 | boolean exists = path.exists(); 150 | if (!exists) { 151 | try{ 152 | return path.mkdir(); 153 | } catch(Exception e){ 154 | e.printStackTrace(); 155 | System.out.println("Error -- Folder path does not exist and cannot be created"); 156 | exists = false; 157 | } 158 | } 159 | return exists; 160 | } 161 | 162 | /** 163 | * Save an individual datastring to a given file location 164 | * @param target Path and file name 165 | * @param fileData Data to be saved 166 | * @return Success or failure 167 | */ 168 | public static Boolean saveFile(String target, String fileData){ 169 | try { 170 | FileWriter outFile = new FileWriter(target); 171 | PrintWriter out = new PrintWriter(outFile); 172 | out.print(fileData); 173 | out.close(); 174 | } catch (IOException e) { 175 | e.printStackTrace(); 176 | return false; 177 | } 178 | return true; 179 | } 180 | 181 | /** 182 | * Updates an existing zipfile stream object with a new entry 183 | * @param fileName Name of the file to be added 184 | * @param zos ZipOutputStream to be updated 185 | * @param dataString Data to be saved in the file 186 | */ 187 | public static void updateZip(String fileName, ZipOutputStream zos, String dataString){ 188 | try { 189 | if (null == dataString && fileName.endsWith("/")){ //this is a folder 190 | ZipEntry ze1 = new ZipEntry(fileName); 191 | zos.putNextEntry(ze1); 192 | zos.closeEntry(); 193 | zos.flush(); 194 | return; 195 | } 196 | 197 | byte[] buf = new byte[1024]; 198 | ZipEntry ze1 = new ZipEntry(fileName); 199 | zos.putNextEntry(ze1); 200 | InputStream is = new ByteArrayInputStream(dataString.getBytes(Charset.defaultCharset())); 201 | int len; 202 | while ((len = is.read(buf)) > 0) { 203 | zos.write(buf, 0, len); 204 | } 205 | zos.closeEntry(); 206 | zos.flush(); 207 | }catch(Exception e){ 208 | e.printStackTrace(); 209 | } 210 | } 211 | 212 | } 213 | -------------------------------------------------------------------------------- /src/main/java/com/wymarc/astrolabe/generator/config/Config.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: AstrolabeGenerator.java,v 3.1 3 | *

4 | * The Astrolabe Generator is free software; you can redistribute it 5 | * and/or modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 3 of 7 | * the License, or(at your option) any later version. 8 | *

9 | * The Astrolabe Generator is distributed in the hope that it will be 10 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 11 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | *

14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *

18 | * Copyright (c) 2017 Timothy J. Mitchell 19 | */ 20 | package com.wymarc.astrolabe.generator.config; 21 | 22 | import com.wymarc.astrolabe.generator.AstrolabeGenerator; 23 | import org.w3c.dom.Document; 24 | import org.w3c.dom.Element; 25 | import org.w3c.dom.Node; 26 | import org.w3c.dom.NodeList; 27 | 28 | import javax.xml.parsers.DocumentBuilder; 29 | import javax.xml.parsers.DocumentBuilderFactory; 30 | import java.io.InputStream; 31 | import java.util.ArrayList; 32 | import java.util.List; 33 | 34 | public class Config { 35 | public static String version = ""; 36 | 37 | private String defaultLocationName = ""; 38 | private String defaultLocation = ""; 39 | private List climateSets; 40 | private List astrolabeExamples; 41 | 42 | public Config() { 43 | try { 44 | InputStream is = AstrolabeGenerator.class.getResourceAsStream("astrolabe_config.xml"); 45 | DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); 46 | DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); 47 | Document doc = dBuilder.parse(is); 48 | doc.getDocumentElement().normalize(); 49 | 50 | // get version 51 | NodeList projectSettings = doc.getElementsByTagName("project"); 52 | Element projectSetting = (Element)projectSettings.item(0); 53 | version = projectSetting.getElementsByTagName("version").item(0).getTextContent(); 54 | 55 | // get default location 56 | NodeList defaultSettings = doc.getElementsByTagName("defaultLocation"); 57 | Element defaultSetting = (Element)defaultSettings.item(0); 58 | defaultLocationName = defaultSetting.getElementsByTagName("name").item(0).getTextContent(); 59 | defaultLocation = defaultSetting.getElementsByTagName("location").item(0).getTextContent(); 60 | 61 | // get example astrolabes 62 | astrolabeExamples = new ArrayList<>(); 63 | NodeList astrolabes = doc.getElementsByTagName("astrolabe"); 64 | for (int i = 0; i < astrolabes.getLength(); i++) { 65 | Node nNode = astrolabes.item(i); 66 | if (nNode.getNodeType() == Node.ELEMENT_NODE) { 67 | Element eElement = (Element) nNode; 68 | AstrolabeExample tempAstrolabe = new AstrolabeExample(); 69 | tempAstrolabe.setName(eElement.getElementsByTagName("name").item(0).getTextContent()); 70 | tempAstrolabe.setShowThrone(eElement.getElementsByTagName("showThrone").item(0).getTextContent().equals("true")); 71 | tempAstrolabe.setShapeOption(Integer.parseInt(eElement.getElementsByTagName("shapeOption").item(0).getTextContent())); 72 | tempAstrolabe.setZodiacSymbols(eElement.getElementsByTagName("zodiacSymbols").item(0).getTextContent().equals("true")); 73 | tempAstrolabe.setShowRegistration(eElement.getElementsByTagName("showRegistration").item(0).getTextContent().equals("true")); 74 | tempAstrolabe.setPrintOption(Integer.parseInt(eElement.getElementsByTagName("printOption").item(0).getTextContent())); 75 | tempAstrolabe.setShowHorizonPlate(eElement.getElementsByTagName("showHorizonPlate").item(0).getTextContent().equals("true")); 76 | tempAstrolabe.setPrintTimeCorrection(eElement.getElementsByTagName("printTimeCorrection").item(0).getTextContent().equals("true")); 77 | tempAstrolabe.setHourMarkings(Integer.parseInt(eElement.getElementsByTagName("hourMarkings").item(0).getTextContent())); 78 | tempAstrolabe.setAlmucantarInterval(Integer.parseInt(eElement.getElementsByTagName("almucantarInterval").item(0).getTextContent())); 79 | tempAstrolabe.setShowAzimuth(eElement.getElementsByTagName("showAzimuth").item(0).getTextContent().equals("true")); 80 | tempAstrolabe.setShowTwilight(eElement.getElementsByTagName("showTwilight").item(0).getTextContent().equals("true")); 81 | tempAstrolabe.setShowAllTwilight(eElement.getElementsByTagName("showAllTwilight").item(0).getTextContent().equals("true")); 82 | tempAstrolabe.setDegreeScaleType(Integer.parseInt(eElement.getElementsByTagName("degreeScaleType").item(0).getTextContent())); 83 | tempAstrolabe.setShowUnequalHours(eElement.getElementsByTagName("showUnequalHours").item(0).getTextContent().equals("true")); 84 | tempAstrolabe.setShowHouses(eElement.getElementsByTagName("showHouses").item(0).getTextContent().equals("true")); 85 | tempAstrolabe.setShowMansions(eElement.getElementsByTagName("showMansions").item(0).getTextContent().equals("true")); 86 | tempAstrolabe.setShowCosine(eElement.getElementsByTagName("showCosine").item(0).getTextContent().equals("true")); 87 | tempAstrolabe.setUse100(eElement.getElementsByTagName("use100").item(0).getTextContent().equals("true")); 88 | tempAstrolabe.setGridPerDegree(eElement.getElementsByTagName("gridPerDegree").item(0).getTextContent().equals("true")); 89 | tempAstrolabe.setShowRadials(eElement.getElementsByTagName("showRadials").item(0).getTextContent().equals("true")); 90 | tempAstrolabe.setShowArcs(eElement.getElementsByTagName("showArcs").item(0).getTextContent().equals("true")); 91 | tempAstrolabe.setShowObliqityArc(eElement.getElementsByTagName("showObliqityArc").item(0).getTextContent().equals("true")); 92 | tempAstrolabe.setBackTopLeft(Integer.parseInt(eElement.getElementsByTagName("backTopLeft").item(0).getTextContent())); 93 | tempAstrolabe.setBackTopRight(Integer.parseInt(eElement.getElementsByTagName("backTopRight").item(0).getTextContent())); 94 | tempAstrolabe.setBackBottomLeft(Integer.parseInt(eElement.getElementsByTagName("backBottomLeft").item(0).getTextContent())); 95 | tempAstrolabe.setBackBottomRight(Integer.parseInt(eElement.getElementsByTagName("backBottomRight").item(0).getTextContent())); 96 | tempAstrolabe.setReteType(Integer.parseInt(eElement.getElementsByTagName("reteType").item(0).getTextContent())); 97 | tempAstrolabe.setShowCotangent(eElement.getElementsByTagName("showCotangent").item(0).getTextContent().equals("true")); 98 | tempAstrolabe.setShowConcentricCalendar(eElement.getElementsByTagName("concentricCalendar").item(0).getTextContent().equals("true")); 99 | tempAstrolabe.setShowEot(eElement.getElementsByTagName("showEot").item(0).getTextContent().equals("true")); 100 | 101 | astrolabeExamples.add(tempAstrolabe); 102 | } 103 | } 104 | 105 | //get climate sets 106 | climateSets = new ArrayList<>(); 107 | NodeList climateSetNodes = doc.getElementsByTagName("climateSet"); 108 | for (int i = 0; i < climateSetNodes.getLength(); i++) { 109 | Node climateSetNode = climateSetNodes.item(i); 110 | ClimateSet climateSet = new ClimateSet(); 111 | climateSet.setName(climateSetNode.getAttributes().getNamedItem("name").getNodeValue()); 112 | if (climateSetNode.getNodeType() == Node.ELEMENT_NODE) { 113 | Element climateSetNodeElement = (Element) climateSetNode; 114 | NodeList climateNodes = climateSetNodeElement.getElementsByTagName("climate"); 115 | for (int j = 0; j < climateNodes.getLength(); j++) { 116 | Node climateNode = climateNodes.item(j); 117 | ClimatePlate climatePlate = new ClimatePlate(); 118 | if (climateNode.getNodeType() == Node.ELEMENT_NODE) { 119 | Element plateElement = (Element) climateNode; 120 | climatePlate.setName(plateElement.getElementsByTagName("name").item(0).getTextContent()); 121 | climatePlate.setLocation(plateElement.getElementsByTagName("latitude").item(0).getTextContent()); 122 | } 123 | climateSet.addClimate(climatePlate); 124 | } 125 | } 126 | climateSets.add(climateSet); 127 | } 128 | } catch (Exception e) { 129 | e.printStackTrace(); 130 | } 131 | } 132 | 133 | public String getDefaultLocationName() { 134 | return defaultLocationName; 135 | } 136 | 137 | public String getDefaultLocation() { 138 | return defaultLocation; 139 | } 140 | 141 | public List getClimateSets(){ 142 | return climateSets; 143 | } 144 | 145 | public ClimateSet getClimateSet(int index){ 146 | return climateSets.get(index); 147 | } 148 | 149 | public List getAstrolabeExamples(){ 150 | return astrolabeExamples; 151 | } 152 | 153 | public AstrolabeExample getAstrolabeExample(int index){ 154 | return astrolabeExamples.get(index); 155 | } 156 | } -------------------------------------------------------------------------------- /src/main/java/com/wymarc/astrolabe/generator/gui/tabbedview/QuadrantPanel.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: AstrolabeGenerator.java,v 3.1 3 | *

4 | * The Astrolabe Generator is free software; you can redistribute it 5 | * and/or modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 3 of 7 | * the License, or(at your option) any later version. 8 | *

9 | * The Astrolabe Generator is distributed in the hope that it will be 10 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 11 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | *

14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *

18 | * Copyright (c) 2017 Timothy J. Mitchell 19 | */ 20 | package com.wymarc.astrolabe.generator.gui.tabbedview; 21 | 22 | import com.wymarc.astrolabe.generator.gui.GeneratorGui; 23 | 24 | import javax.swing.*; 25 | import java.awt.*; 26 | import java.awt.event.ActionEvent; 27 | import java.awt.event.ActionListener; 28 | import java.awt.event.MouseEvent; 29 | import java.awt.event.MouseListener; 30 | 31 | public class QuadrantPanel extends JPanel implements ActionListener,MouseListener { 32 | private JCheckBox simpleHoraryCheck = null; 33 | private JCheckBox advancedHoraryCheck = null; 34 | private JCheckBox equalHoursHoraryCheck = null; 35 | private JCheckBox sineCheck = null; 36 | private JCheckBox colorSineCheck = null; 37 | private JCheckBox advancedSineCheck = null; 38 | private ThumbNail thumbNail = null; 39 | 40 | public QuadrantPanel() { 41 | super(); 42 | setLayout(new BorderLayout()); 43 | 44 | JPanel leftPanel = new JPanel(); 45 | leftPanel.setLayout(new BorderLayout()); 46 | 47 | JPanel optionsPanel = new JPanel(); 48 | optionsPanel.setLayout(new GridBagLayout()); 49 | 50 | JLabel label = new JLabel("A selection of quadrant types can be included:"); 51 | GridBagConstraints c = new GridBagConstraints(); 52 | c.fill = GridBagConstraints.HORIZONTAL; 53 | c.insets = new Insets(5,10,5,5); 54 | c.gridx = 0; 55 | c.gridy = 0; 56 | optionsPanel.add(label,c); 57 | c.gridy++; 58 | optionsPanel.add(getSimpleHoraryCheck(),c); 59 | c.gridy++; 60 | optionsPanel.add(getAdvancedHoraryCheck(),c); 61 | c.gridy++; 62 | optionsPanel.add( new JSeparator(JSeparator.HORIZONTAL),c); 63 | c.gridy++; 64 | optionsPanel.add(getEqualHoursHoraryCheck(),c); 65 | c.gridy++; 66 | optionsPanel.add( new JSeparator(JSeparator.HORIZONTAL),c); 67 | c.gridy++; 68 | optionsPanel.add(getSineCheck(),c); 69 | c.gridy++; 70 | optionsPanel.add(getColorSineCheck(),c); 71 | c.gridy++; 72 | optionsPanel.add(getAdvancedSineCheck(),c); 73 | 74 | leftPanel.add(optionsPanel, BorderLayout.NORTH); 75 | add(leftPanel,BorderLayout.WEST); 76 | 77 | add(getThumbNail("ColorSineQuadrant"),BorderLayout.EAST); // default to color Sine for start 78 | } 79 | 80 | private JPanel getThumbNail(String hoverObject){ 81 | if (null == thumbNail){ 82 | thumbNail = new ThumbNail(); 83 | } 84 | return thumbNail.updateQuadrantThumbNail(hoverObject); 85 | } 86 | 87 | private JCheckBox getSimpleHoraryCheck(){ 88 | if (null == simpleHoraryCheck){ 89 | simpleHoraryCheck = new JCheckBox("Unequal hours horary quadrant (BASIC)"); 90 | simpleHoraryCheck.setSelected(GeneratorGui.MY_ASTROLABE.getPrintBasicHoraryQuadrant()); 91 | simpleHoraryCheck.setToolTipText("Include an unequal hours horary quadrant"); 92 | simpleHoraryCheck.setActionCommand("UnequalHorary"); 93 | simpleHoraryCheck.addActionListener(this); 94 | simpleHoraryCheck.addMouseListener(this); 95 | } 96 | return simpleHoraryCheck; 97 | } 98 | 99 | private JCheckBox getAdvancedHoraryCheck(){ 100 | if (null == advancedHoraryCheck){ 101 | advancedHoraryCheck = new JCheckBox("Unequal hours horary quadrant (ADVANCED)"); 102 | advancedHoraryCheck.setSelected(GeneratorGui.MY_ASTROLABE.getPrintAdvancedHoraryQuadrant()); 103 | advancedHoraryCheck.setToolTipText("Include an advanced unequal hours horary quadrant"); 104 | advancedHoraryCheck.setActionCommand("AdvancedUnequalHorary"); 105 | advancedHoraryCheck.addActionListener(this); 106 | advancedHoraryCheck.addMouseListener(this); 107 | } 108 | return advancedHoraryCheck; 109 | } 110 | 111 | private JCheckBox getEqualHoursHoraryCheck(){ 112 | if (null == equalHoursHoraryCheck){ 113 | equalHoursHoraryCheck = new JCheckBox("Equal hours horary quadrant (front and back)"); 114 | equalHoursHoraryCheck.setSelected(GeneratorGui.MY_ASTROLABE.getPrintEqualHoursHoraryQuadrant()); 115 | equalHoursHoraryCheck.setToolTipText("Include an equal hours horary quadrant"); 116 | equalHoursHoraryCheck.setActionCommand("EqualHoursHorary"); 117 | equalHoursHoraryCheck.addActionListener(this); 118 | equalHoursHoraryCheck.addMouseListener(this); 119 | } 120 | return equalHoursHoraryCheck; 121 | } 122 | 123 | private JCheckBox getSineCheck(){ 124 | if (null == sineCheck){ 125 | sineCheck = new JCheckBox("Sine quadrant"); 126 | sineCheck.setSelected(GeneratorGui.MY_ASTROLABE.getPrintSineQuadrant()); 127 | sineCheck.setToolTipText("Include a sine quadrant"); 128 | sineCheck.setActionCommand("SineQuadrant"); 129 | sineCheck.addActionListener(this); 130 | sineCheck.addMouseListener(this); 131 | } 132 | return sineCheck; 133 | } 134 | private JCheckBox getColorSineCheck(){ 135 | if (null == colorSineCheck){ 136 | colorSineCheck = new JCheckBox("Sine quadrant (COLOR)"); 137 | colorSineCheck.setSelected(GeneratorGui.MY_ASTROLABE.getPrintSineQuadrant()); 138 | colorSineCheck.setToolTipText("Include a color sine quadrant"); 139 | colorSineCheck.setActionCommand("ColorSineQuadrant"); 140 | colorSineCheck.addActionListener(this); 141 | colorSineCheck.addMouseListener(this); 142 | } 143 | return colorSineCheck; 144 | } 145 | 146 | private JCheckBox getAdvancedSineCheck(){ 147 | if (null == advancedSineCheck){ 148 | advancedSineCheck = new JCheckBox("Sine quadrant with vernier scale"); 149 | advancedSineCheck.setSelected(GeneratorGui.MY_ASTROLABE.getPrintAdvancedSineQuadrant()); 150 | advancedSineCheck.setToolTipText("Include a sine quadrant with vernier scale"); 151 | advancedSineCheck.setActionCommand("AdvancedSine"); 152 | advancedSineCheck.addActionListener(this); 153 | advancedSineCheck.addMouseListener(this); 154 | } 155 | return advancedSineCheck; 156 | } 157 | 158 | public void actionPerformed(ActionEvent e) { 159 | String cmd = e.getActionCommand(); 160 | 161 | if (cmd.equals("UnequalHorary")) { 162 | GeneratorGui.MY_ASTROLABE.setPrintBasicHoraryQuadrant(getSimpleHoraryCheck().isSelected()); 163 | }else if (cmd.equals("AdvancedUnequalHorary")) { 164 | // this quadrant is limited to as to latitude 165 | if (withinLimits()){ 166 | GeneratorGui.MY_ASTROLABE.setPrintAdvancedHoraryQuadrant(getAdvancedHoraryCheck().isSelected()); 167 | }else{ 168 | getAdvancedHoraryCheck().setSelected(false); 169 | } 170 | }else if (cmd.equals("EqualHoursHorary")) { 171 | // this quadrant is limited to as to latitude 172 | if (withinLimits()){ 173 | GeneratorGui.MY_ASTROLABE.setPrintEqualHoursHoraryQuadrant(getEqualHoursHoraryCheck().isSelected()); 174 | }else{ 175 | getEqualHoursHoraryCheck().setSelected(false); 176 | } 177 | 178 | }else if (cmd.equals("SineQuadrant")) { 179 | GeneratorGui.MY_ASTROLABE.setPrintSineQuadrant(getSineCheck().isSelected()); 180 | }else if (cmd.equals("ColorSineQuadrant")) { 181 | GeneratorGui.MY_ASTROLABE.setPrintColorSineQuadrant(getColorSineCheck().isSelected()); 182 | }else if (cmd.equals("AdvancedSine")) { 183 | GeneratorGui.MY_ASTROLABE.setPrintAdvancedSineQuadrant(getAdvancedSineCheck().isSelected()); 184 | } 185 | } 186 | 187 | public void mouseClicked(MouseEvent e) { 188 | 189 | } 190 | 191 | public void mousePressed(MouseEvent e) { 192 | 193 | } 194 | 195 | public void mouseReleased(MouseEvent e) { 196 | 197 | } 198 | 199 | public void mouseEntered(MouseEvent e) { 200 | String text = ""; 201 | String action = ""; 202 | Object obj = e.getSource(); 203 | if (obj instanceof JCheckBox){ 204 | text = ((JCheckBox) obj).getToolTipText(); 205 | action = ((JCheckBox) obj).getActionCommand(); 206 | } 207 | 208 | GeneratorGui.setStatusLabel(text); 209 | getThumbNail(action); 210 | } 211 | 212 | public void mouseExited(MouseEvent e) { 213 | GeneratorGui.setStatusLabel(""); 214 | } 215 | 216 | private boolean withinLimits(){ 217 | double UPPERLIMIT = 65.0; 218 | double LOWERLIMIT = 25.0; 219 | double latitude = GeneratorGui.MY_ASTROLABE.getLocation().getLatitude(); 220 | String hemisphere = GeneratorGui.MY_ASTROLABE.getLocation().getLatDir().toUpperCase(); 221 | 222 | if (hemisphere.equals("N") && latitude >= LOWERLIMIT && latitude <= UPPERLIMIT){ 223 | return true; 224 | } 225 | 226 | JOptionPane.showMessageDialog(null,"This quadrant is limited to latitudes between 25 North and 65 North","Unavailable",JOptionPane.ERROR_MESSAGE); 227 | return false; 228 | } 229 | } 230 | -------------------------------------------------------------------------------- /src/main/java/com/wymarc/astrolabe/generator/printengines/postscript/extras/horary/BasicHoraryQuadrant.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: AstrolabeGenerator.java,v 3.1 3 | *

4 | * The Astrolabe Generator is free software; you can redistribute it 5 | * and/or modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 3 of 7 | * the License, or(at your option) any later version. 8 | *

9 | * The Astrolabe Generator is distributed in the hope that it will be 10 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 11 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | *

14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *

18 | * Copyright (c) 2017 Timothy J. Mitchell 19 | */ 20 | package com.wymarc.astrolabe.generator.printengines.postscript.extras.horary; 21 | 22 | import com.wymarc.astrolabe.generator.printengines.postscript.util.EPSToolKit; 23 | 24 | /** 25 | * This Plugin will calculate the components of Horary Quadrant and 26 | * print the results to an Encapsulated PostScript (EPS) file. Note that 27 | * This file is static with no inputs. Software is included for reference. 28 | *

29 | * link http://astrolabeproject.com.com 30 | * link http://www.astrolabes.org 31 | */ 32 | 33 | public class BasicHoraryQuadrant { 34 | 35 | /** 36 | * computes and draws the shadow squares 37 | * 38 | * @return returns the ps code for drawing the Shadow Squares 39 | */ 40 | private String buildShadowSquare() { 41 | //compute size of box 42 | // note eventually this will be done by looking at what rings are drawn and figuring 43 | // the remaining radius 44 | double shadowSide = 191; 45 | int count; 46 | double div = 12.0; 47 | StringBuilder out = new StringBuilder(); 48 | 49 | //Draw bottom right 50 | out.append("\n").append("% =============== Create Right Shadow Square =================") 51 | .append("\n").append("newpath") 52 | .append("\n").append("0 0 moveto") 53 | .append("\n").append(shadowSide).append(" 0 lineto") 54 | .append("\n").append(shadowSide).append(" ").append(-shadowSide).append(" lineto") 55 | .append("\n").append("0 ").append(-shadowSide).append(" lineto") 56 | .append("\n").append("0 0 lineto stroke") 57 | .append("\n").append("0 0 moveto"); 58 | 59 | for (count = 1; count < div; count++)// print division lines 60 | { 61 | out.append("\n").append("0 0 moveto") 62 | .append("\n").append(shadowSide).append(" ").append(-((shadowSide / div) * count)).append(" lineto stroke") 63 | .append("\n").append("0 0 moveto") 64 | .append("\n").append((shadowSide / div) * count).append(" ").append(-shadowSide).append(" lineto stroke"); 65 | } 66 | out.append("\n").append("newpath") 67 | .append("\n").append("1 setgray") 68 | .append("\n").append("0 0 moveto") 69 | .append("\n").append(shadowSide - 6).append(" 0 lineto") 70 | .append("\n").append(shadowSide - 6).append(" ").append(-(shadowSide - 6)).append(" lineto") 71 | .append("\n").append("0 ").append(-(shadowSide - 6)).append(" lineto") 72 | .append("\n").append("0 0 lineto fill") 73 | .append("\n").append("newpath") 74 | .append("\n").append("0 setgray") 75 | .append("\n").append("0 0 moveto") 76 | .append("\n").append(shadowSide - 6).append(" 0 lineto") 77 | .append("\n").append(shadowSide - 6).append(" ").append(-(shadowSide - 6)).append(" lineto") 78 | .append("\n").append("0 ").append(-(shadowSide - 6)).append(" lineto") 79 | .append("\n").append("0 0 lineto stroke"); 80 | 81 | //draw 1/2 way mark 82 | out.append("\n").append("0 0 moveto") 83 | .append("\n").append(shadowSide).append(" ").append(-shadowSide / 2.0).append(" lineto stroke") 84 | .append("\n").append("0 0 moveto") 85 | .append("\n").append(shadowSide / 2.0).append(" ").append(-shadowSide).append(" lineto stroke") 86 | .append("\n").append("newpath") 87 | .append("\n").append("1 setgray") 88 | .append("\n").append("0 0 moveto") 89 | .append("\n").append(shadowSide - 12).append(" 0 lineto") 90 | .append("\n").append(shadowSide - 12).append(" ").append(-(shadowSide - 12)).append(" lineto") 91 | .append("\n").append("0 ").append(-(shadowSide - 12)).append(" lineto") 92 | .append("\n").append("0 0 lineto fill") 93 | .append("\n").append("0 setgray") 94 | .append("\n").append((shadowSide / 2.0) - 8).append(" ").append(-(shadowSide - 7)).append(" moveto") 95 | .append("\n").append("NormalFont5 setfont"); 96 | 97 | // mark 6 line 98 | out.append("\n").append("(6) show") 99 | .append("\n").append((shadowSide - 10)).append(" ").append(-(shadowSide / 2.0)).append(" moveto") 100 | .append("\n").append("(6) show") 101 | .append("\n").append("newpath") 102 | .append("\n").append("0 0 moveto") 103 | .append("\n").append(shadowSide - 12).append(" 0 lineto") 104 | .append("\n").append(shadowSide - 12).append(" ").append(-(shadowSide - 12)).append(" lineto") 105 | .append("\n").append("0 ").append(-(shadowSide - 12)).append(" lineto") 106 | .append("\n").append("0 0 lineto stroke") 107 | .append("\n").append("0 0 moveto"); 108 | 109 | // mark 45 line 110 | out.append("\n").append(shadowSide).append(" ").append(-shadowSide).append(" lineto stroke") // 45 line 111 | .append("\n").append(shadowSide - 16).append(" ").append(-(shadowSide - 7)).append(" moveto") 112 | .append("\n").append("NormalFont5 setfont") 113 | .append("\n").append("(12) show"); 114 | 115 | out.append("\n").append("% =============== End Right Shadow Square ================="); 116 | 117 | return out.toString(); 118 | } 119 | 120 | public String printQuadrant() { 121 | StringBuilder out = new StringBuilder(); 122 | 123 | int count; 124 | Double Ri; 125 | 126 | // Write header to file 127 | out.append("\n").append("%!PS-Adobe-3.0 EPSF-30.") 128 | .append("\n").append("%%BoundingBox: 0 0 612 792") 129 | .append("\n").append("%%Title: Basic Horary Quadrant") 130 | .append("\n").append("%%Creator: Richard Wymarc") 131 | .append("\n").append("%%CreationDate: ") 132 | .append("\n").append("%%EndComments"); 133 | 134 | out.append("\n").append("mark") 135 | .append("\n").append("/Quadrant 10 dict def %local variable dictionary") 136 | .append("\n").append("Quadrant begin") 137 | .append("\n").append("") 138 | .append("\n").append("%% setup") 139 | .append("\n").append(EPSToolKit.fillBackground()) 140 | .append("\n").append("108 630 translate") 141 | .append("\n").append(".4 setlinewidth") 142 | .append("\n").append("") 143 | .append("\n").append(EPSToolKit.setUpFonts()) 144 | .append("\n").append(EPSToolKit.setUpCircularText()) 145 | .append("\n").append("gsave") 146 | .append("\n").append(""); 147 | 148 | // draw limbs 149 | out.append("\n").append("% draw Limb") 150 | .append("\n").append("newpath") 151 | .append("\n").append("0 0 moveto") 152 | .append("\n").append("0 -432 rlineto") 153 | .append("\n").append("36 0 rlineto") 154 | .append("\n").append("0 396 rlineto") 155 | .append("\n").append("396 0 rlineto") 156 | .append("\n").append("0 36 rlineto") 157 | .append("\n").append("-432 0 rlineto stroke") 158 | .append("\n").append(""); 159 | 160 | // draw quadrants 161 | out.append("\n").append("% quadrants") 162 | .append("\n").append("36 -36 translate") 163 | .append("\n").append("0 0 5 0 360 arc stroke") 164 | .append("\n").append("0 0 396 270 360 arc stroke") 165 | .append("\n").append("0 0 386 270 360 arc stroke") 166 | .append("\n").append("0 0 382 270 360 arc stroke") 167 | .append("\n").append(""); 168 | 169 | // create 1 degree marks 170 | for (count = 1; count <= 90; count++) { 171 | out.append("\n").append("382 0 moveto") 172 | .append("\n").append("386 0 lineto stroke") 173 | .append("\n").append("-1 rotate"); 174 | } 175 | out.append("\n").append("90 rotate"); 176 | 177 | // create 5 degree marks 178 | for (count = 1; count <= 18; count++) { 179 | out.append("\n").append("382 0 moveto") 180 | .append("\n").append("390 0 lineto stroke") 181 | .append("\n").append("-5 rotate"); 182 | } 183 | out.append("\n").append("90 rotate"); 184 | 185 | // create 10 degree marks 186 | for (count = 1; count <= 9; count++) { 187 | out.append("\n").append("382 0 moveto") 188 | .append("\n").append("396 0 lineto stroke") 189 | .append("\n").append("-10 rotate"); 190 | } 191 | out.append("\n").append("90 rotate"); 192 | 193 | //Mark degrees 194 | out.append("\n").append("/Times-Roman findfont 5 scalefont setfont"); 195 | for (count = 1; count <= 9; count++) { 196 | out.append("\n").append(EPSToolKit.drawInsideCircularText((count * 10) + "", 5, (-90 + (count * 10) - 0.5), 392)); 197 | } 198 | 199 | //Shadow Square 200 | out.append("\n").append(buildShadowSquare()); 201 | 202 | // mark unequal hour lines 203 | out.append("\n").append("newpath") 204 | .append("\n").append("382 0 moveto") 205 | .append("\n").append("0 0 lineto") 206 | .append("\n").append("0 -382 lineto") 207 | .append("\n").append("0 0 382 270 360 arc clip"); 208 | for (count = 1; count <= 6; count++) { 209 | Ri = (382 / (2 * (Math.sin(Math.toRadians(15 * count))))); 210 | out.append("\n").append(Ri).append(" 0 ").append(Ri).append(" 180 360 arc stroke"); 211 | } 212 | 213 | //Mark unequal hours 214 | out.append("\n").append("/Times-Roman findfont 5 scalefont setfont"); 215 | for (count = 1; count <= 5; count++) { 216 | out.append("\n").append(EPSToolKit.drawInsideCircularText(count + "", 5, (-90 + (count * 15) + 0.5), 380)); 217 | } 218 | 219 | // Write Footer 220 | out.append("\n").append("% Eject the page") 221 | .append("\n").append("end cleartomark") 222 | .append("\n").append("showpage"); 223 | 224 | return out.toString(); 225 | 226 | } 227 | } -------------------------------------------------------------------------------- /src/main/java/com/wymarc/astrolabe/generator/gui/GeneratorGui.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: AstrolabeGenerator.java,v 3.1 3 | *

4 | * The Astrolabe Generator is free software; you can redistribute it 5 | * and/or modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 3 of 7 | * the License, or(at your option) any later version. 8 | *

9 | * The Astrolabe Generator is distributed in the hope that it will be 10 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 11 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | *

14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *

18 | * Copyright (c) 2017 Timothy J. Mitchell 19 | */ 20 | package com.wymarc.astrolabe.generator.gui; 21 | 22 | import com.wymarc.astrolabe.Astrolabe; 23 | import com.wymarc.astrolabe.Location; 24 | import com.wymarc.astrolabe.generator.config.AstrolabeExample; 25 | import com.wymarc.astrolabe.generator.config.Config; 26 | import com.wymarc.astrolabe.generator.gui.dialogs.AboutDialog; 27 | import com.wymarc.astrolabe.generator.gui.dialogs.HelpDialog; 28 | import com.wymarc.astrolabe.generator.gui.dialogs.ResourcesDialog; 29 | import com.wymarc.astrolabe.generator.gui.tabbedview.*; 30 | import com.wymarc.astrolabe.generator.io.FileHandler; 31 | import com.wymarc.astrolabe.generator.printengines.postscript.EPSPrintEngine; 32 | 33 | import javax.print.DocFlavor; 34 | import javax.print.PrintService; 35 | import javax.print.PrintServiceLookup; 36 | import javax.print.attribute.HashPrintRequestAttributeSet; 37 | import javax.print.attribute.PrintRequestAttributeSet; 38 | import javax.swing.*; 39 | import javax.swing.border.EmptyBorder; 40 | import javax.swing.event.ChangeEvent; 41 | import javax.swing.event.ChangeListener; 42 | import java.awt.*; 43 | import java.awt.event.ActionEvent; 44 | import java.awt.event.ActionListener; 45 | import java.util.List; 46 | 47 | public class GeneratorGui extends JFrame implements ActionListener { 48 | public static Astrolabe MY_ASTROLABE = null; 49 | public static Config MY_CONFIG = null; 50 | public static boolean HAS_PRINTER_SUPPORT = false; 51 | public static String tabSelected = "Front"; 52 | private static JLabel statusLabel = new JLabel(""); 53 | 54 | private GeneratorMenuBar windowMenuBar = null; 55 | private JPanel statusPanel = null; 56 | private GeneratorToolBar toolBar = null; 57 | private GeneratorTabbedPane tabPane = null; 58 | 59 | public GeneratorGui(){ 60 | super("Astrolabe Generator"); 61 | MY_ASTROLABE = new Astrolabe(); 62 | MY_CONFIG = new Config(); 63 | initAstrolabe(0); 64 | createAndShowGUI(); 65 | } 66 | 67 | private void initAstrolabe(int index){ 68 | MY_ASTROLABE.getLocation().setLocationName(MY_CONFIG.getDefaultLocationName()); 69 | MY_ASTROLABE.getLocation().setLocation(MY_CONFIG.getDefaultLocation()); 70 | AstrolabeExample defaultAstrolabe = MY_CONFIG.getAstrolabeExamples().get(index); 71 | if (null != defaultAstrolabe){ 72 | MY_ASTROLABE.setShowThrone(defaultAstrolabe.isShowThrone()); 73 | MY_ASTROLABE.setShapeOption(defaultAstrolabe.getShapeOption()); 74 | MY_ASTROLABE.setShowZodiacSymbols(defaultAstrolabe.isZodiacSymbols()); 75 | MY_ASTROLABE.setShowRegistrationMarks(defaultAstrolabe.isShowRegistration()); 76 | MY_ASTROLABE.setFrontPrintOption(defaultAstrolabe.getPrintOption()); 77 | MY_ASTROLABE.setShowHorizonPlate(defaultAstrolabe.isShowHorizonPlate()); 78 | MY_ASTROLABE.setShowTimeCorrection(defaultAstrolabe.isPrintTimeCorrection()); 79 | MY_ASTROLABE.setHourMarkings(defaultAstrolabe.getHourMarkings()); 80 | MY_ASTROLABE.setAlmucanterInterval(defaultAstrolabe.getAlmucantarInterval()); 81 | MY_ASTROLABE.setShowAzimuthLines(defaultAstrolabe.isShowAzimuth()); 82 | MY_ASTROLABE.setShowTwilightLines(defaultAstrolabe.isShowTwilight()); 83 | MY_ASTROLABE.setShowAllTwilightLines(defaultAstrolabe.isShowAllTwilight()); 84 | MY_ASTROLABE.setDegreeScaleType(defaultAstrolabe.getDegreeScaleType()); 85 | MY_ASTROLABE.setShowUnequalHoursLines(defaultAstrolabe.isShowUnequalHours()); 86 | MY_ASTROLABE.setShowHousesofHeavenLines(defaultAstrolabe.isShowHouses()); 87 | MY_ASTROLABE.setShowLunarMansions(defaultAstrolabe.isShowMansions()); 88 | MY_ASTROLABE.setShowCosine(defaultAstrolabe.isShowCosine()); 89 | MY_ASTROLABE.setUse100(defaultAstrolabe.isUse100()); 90 | MY_ASTROLABE.setGridPerDegree(defaultAstrolabe.isGridPerDegree()); 91 | MY_ASTROLABE.setShowRadials(defaultAstrolabe.isShowRadials()); 92 | MY_ASTROLABE.setShowArcs(defaultAstrolabe.isShowArcs()); 93 | MY_ASTROLABE.setShowObliqityArc(defaultAstrolabe.isShowObliqityArc()); 94 | MY_ASTROLABE.setTopLeft(defaultAstrolabe.getBackTopLeft()); 95 | MY_ASTROLABE.setTopRight(defaultAstrolabe.getBackTopRight()); 96 | MY_ASTROLABE.setBottomLeft(defaultAstrolabe.getBackBottomLeft()); 97 | MY_ASTROLABE.setBottomRight(defaultAstrolabe.getBackBottomRight()); 98 | MY_ASTROLABE.setReteType(defaultAstrolabe.getReteType()); 99 | MY_ASTROLABE.setShowCotangentScale(defaultAstrolabe.isShowCotangent()); 100 | MY_ASTROLABE.setShowConcentricCalendar(defaultAstrolabe.isShowConcentricCalendar()); 101 | MY_ASTROLABE.setShowEquationOfTime(defaultAstrolabe.isShowEot()); 102 | } 103 | } 104 | 105 | /** 106 | * Create the GUI and show it. For thread safety, 107 | * this method should be invoked from the 108 | * event-dispatching thread. 109 | */ 110 | private void createAndShowGUI() { 111 | //first test for printer support we are only interested in PostScript printers 112 | DocFlavor postscript = DocFlavor.INPUT_STREAM.POSTSCRIPT; 113 | PrintRequestAttributeSet attributeSet = new HashPrintRequestAttributeSet(); 114 | PrintService[] printService = PrintServiceLookup.lookupPrintServices(postscript, attributeSet); 115 | if (printService.length > 0){ 116 | HAS_PRINTER_SUPPORT = true; 117 | } 118 | 119 | //Create and set up the window. 120 | setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); 121 | setPreferredSize(new Dimension(900, 700)); 122 | setLayout(new BorderLayout()); 123 | 124 | setJMenuBar(getWindowMenuBar()); 125 | add(getToolBar(), BorderLayout.NORTH); 126 | add(getStatusBar(), BorderLayout.SOUTH); 127 | add(getTabPane()); 128 | 129 | //Display the window. 130 | pack(); 131 | setLocationRelativeTo(null); 132 | 133 | updateGui(); 134 | 135 | setVisible(true); 136 | } 137 | 138 | private void updateGui(){ 139 | //update location 140 | GeneratorToolBar toolBar = getToolBar(); 141 | toolBar.getNameText().setText(MY_ASTROLABE.getUserName()); 142 | toolBar.getLocationNameText().setText(MY_ASTROLABE.getLocation().getLocationName()); 143 | toolBar.getLocationText().setText(MY_ASTROLABE.getLocation().getDisplayString()); 144 | getTabPane().updateControls(); 145 | } 146 | 147 | private boolean updateAstrolabe(){ 148 | GeneratorToolBar toolBar = getToolBar(); 149 | JTextField locationText = toolBar.getLocationText(); 150 | if (!Location.isValidLocation(locationText.getText())) { 151 | locationText.setForeground(Color.RED); 152 | SwingUtilities.invokeLater(new FocusGrabber(locationText)); 153 | JOptionPane.showMessageDialog(null, "Location must be in the format: ddmmssh dddmmssh. \n" + 154 | "for example, \n\n" + 155 | "45 degrees 30 minutes, 25 seconds North, \n" + 156 | "120 degrees, 40 minutes, 13 seconds West \n\n" + 157 | "would be: 453025N 1204013W","Location Error",JOptionPane.ERROR_MESSAGE); 158 | return false; 159 | }else{ 160 | MY_ASTROLABE.getLocation().setLocation(locationText.getText()); 161 | } 162 | 163 | MY_ASTROLABE.setUserName(toolBar.getNameText().getText()); 164 | MY_ASTROLABE.getLocation().setLocationName(toolBar.getLocationNameText().getText()); 165 | return true; 166 | } 167 | 168 | private JMenuBar getWindowMenuBar(){ 169 | if(null == windowMenuBar){ 170 | windowMenuBar = new GeneratorMenuBar(this); 171 | } 172 | return windowMenuBar; 173 | } 174 | 175 | private GeneratorToolBar getToolBar(){ 176 | if (null == toolBar){ 177 | toolBar = new GeneratorToolBar(this); 178 | } 179 | return toolBar; 180 | } 181 | 182 | private JPanel getStatusBar(){ 183 | if(null == statusPanel){ 184 | statusPanel = new JPanel(); 185 | statusPanel.setBorder(new EmptyBorder(5,10,5,10)); 186 | statusPanel.setLayout(new BorderLayout()); 187 | 188 | //JLabel statusLabel = new JLabel("tooltip"); 189 | statusPanel.add(statusLabel, BorderLayout.WEST); 190 | 191 | JLabel versionLabel = new JLabel("v" + Config.version + " astrolabeproject.com"); 192 | statusLabel.setHorizontalAlignment(SwingConstants.RIGHT); 193 | statusPanel.add(versionLabel, BorderLayout.EAST); 194 | } 195 | return statusPanel; 196 | } 197 | 198 | private GeneratorTabbedPane getTabPane(){ 199 | if (null == tabPane){ 200 | tabPane = new GeneratorTabbedPane(); 201 | ChangeListener changeListener = new ChangeListener() { 202 | public void stateChanged(ChangeEvent changeEvent) { 203 | GeneratorTabbedPane sourceTabbedPane = (GeneratorTabbedPane) changeEvent.getSource(); 204 | int index = sourceTabbedPane.getSelectedIndex(); 205 | tabSelected = sourceTabbedPane.getTitleAt(index); 206 | if (index == 0){ 207 | sourceTabbedPane.getFrontPanel().getThumbNail().updateUI(); 208 | }else if (index == 1){ 209 | sourceTabbedPane.getBackPanel().getThumbNail().updateUI(); 210 | }else if (index == 2){ 211 | sourceTabbedPane.getRetePanel().getThumbNail().updateUI(); 212 | } 213 | } 214 | }; 215 | tabPane.addChangeListener(changeListener); 216 | } 217 | return tabPane; 218 | } 219 | 220 | private void saveToFolder() { 221 | // make sure Astrolabe is updated 222 | if (!updateAstrolabe()){ 223 | return; 224 | } 225 | // create Astrolabe files 226 | EPSPrintEngine epsAstrolabe = new EPSPrintEngine(); 227 | epsAstrolabe.saveFiles(); 228 | } 229 | 230 | private void saveToZip() { 231 | // make sure Astrolabe is updated 232 | if (!updateAstrolabe()){ 233 | return; 234 | } 235 | 236 | // create Astrolabe files 237 | EPSPrintEngine epsAstrolabe = new EPSPrintEngine(); 238 | epsAstrolabe.saveZip(); 239 | } 240 | 241 | private void print(Boolean printAll) { 242 | // make sure Astrolabe is updated 243 | if (!updateAstrolabe()){ 244 | return; 245 | } 246 | EPSPrintEngine epsAstrolabe = new EPSPrintEngine(); 247 | if (printAll){ 248 | epsAstrolabe.printAll(); 249 | } else{ 250 | epsAstrolabe.printCurrent(); 251 | } 252 | } 253 | 254 | public void actionPerformed(ActionEvent e) { 255 | String action = e.getActionCommand(); 256 | 257 | if (action.equals("Save to folder")){ 258 | saveToFolder(); 259 | } else if (action.equals("Save to Zip")){ 260 | saveToZip(); 261 | } else if (action.equals("Print all")){ 262 | print(true); 263 | } else if (action.equals("Print current view")){ 264 | print(false); 265 | } else if (action.equals("Program Help")){ 266 | new HelpDialog(this); 267 | } else if (action.equals("Astrolabe Resources")){ 268 | new ResourcesDialog(this); 269 | } else if (action.equals("About")){ 270 | new AboutDialog(this); 271 | } else if (action.equals("Assembly Instructions")){ 272 | FileHandler.saveInstructable(); 273 | } else { 274 | // check list of astrolabe examples 275 | List astrolabeList = MY_CONFIG.getAstrolabeExamples(); 276 | for (int i = 0; i < astrolabeList.size(); i++){ 277 | if (astrolabeList.get(i).getName().equals(e.getActionCommand())){ 278 | // set up this astrolabe 279 | initAstrolabe(i); 280 | updateGui(); 281 | } 282 | } 283 | } 284 | 285 | } 286 | 287 | public static void setStatusLabel(String text) { 288 | GeneratorGui.statusLabel.setText(text); 289 | } 290 | } 291 | --------------------------------------------------------------------------------