Snifflib Numerical Library Wiki
Open-source computational library written in pure JAVA
Brought to you by:
mock_turtle
Using Snifflib it is possible to treat polygonal data as gridded elements. This makes graphical rendering a snap, but also allows you to perform various tricks on the coordinates of the polygonal regions or to overlay and combine various regions in the same image. Here is an example where we parse the polygon coordinates of all 50 United States from ARC/INFO Ungenerate (ASCII) source files and then render just a few in an axes.
/* Groovy Script illustrating basic graphics functionality of the open-source Snifflib JAVA library. */ import java.io.File; import com.mockturtlesolutions.snifflib.datatypes.DblMatrix; import com.mockturtlesolutions.snifflib.util.database.GridElementDOM; import java.util.HashSet; import com.mockturtlesolutions.snifflib.graphics.*; import com.mockturtlesolutions.snifflib.util.database.GridElementConfig; //Bring in the map data from ARC/INFO Ungenerate (ASCII) source files. GridElementDOM DOM = new GridElementDOM(); F = new File("/home/jdoe/USCENSUGOVMAPS/st99_d00.dat"); H = new File("/home/jdoe/USCENSUGOVMAPS/st99_d00a.dat"); S = new HashSet(); S.add("145"); S.add("146"); S.add("147"); S.add("83"); //Create the region DOM.importAsChildUNG(S,H,F,1); //Set up the axes AX = SLFigure.newPlotFrame(); AX.setXLim(new DblMatrix("[-133.0;-100.0]")); AX.setYLim(new DblMatrix("[10.0;55.0]")); //Render the image SL = new SLPolyRegion(AX); SL.addGridElement(DOM);
The result should look something like the following