68 lines
1.9 KiB
Java
68 lines
1.9 KiB
Java
|
|
package ecoparasite.svg.elements;
|
||
|
|
|
||
|
|
import ecoparasite.svg.Coordonnees;
|
||
|
|
|
||
|
|
import java.util.ArrayList;
|
||
|
|
import java.util.HashSet;
|
||
|
|
|
||
|
|
public class ElementsFactory {
|
||
|
|
|
||
|
|
final public static int SVG_SIZE = 800;
|
||
|
|
final public static int SVG_OFFSET = 50;
|
||
|
|
|
||
|
|
final public static int AXES_TEXT_SIZE = 10;
|
||
|
|
|
||
|
|
final public static String COLOR_RED = "red";
|
||
|
|
final public static String COLOR_BLUE = "blue";
|
||
|
|
final public static String COLOR_BLACK = "black";
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Permet de générer les éléments axes du fichier SVG.
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public static ArrayList<Element> SVGAxes(String HName, String VName ){
|
||
|
|
|
||
|
|
final int begin = SVG_OFFSET + AXES_TEXT_SIZE + (AXES_TEXT_SIZE / 2);
|
||
|
|
final int end = SVG_SIZE - SVG_OFFSET - AXES_TEXT_SIZE - (AXES_TEXT_SIZE / 2);
|
||
|
|
|
||
|
|
Element V = new Line(
|
||
|
|
new Coordonnees( begin, begin ),
|
||
|
|
new Coordonnees( begin, SVG_SIZE - SVG_OFFSET ),
|
||
|
|
COLOR_BLACK,
|
||
|
|
2
|
||
|
|
);
|
||
|
|
|
||
|
|
Element H = new Line(
|
||
|
|
new Coordonnees( begin, SVG_SIZE - SVG_OFFSET ),
|
||
|
|
new Coordonnees( end, SVG_SIZE - SVG_OFFSET ),
|
||
|
|
COLOR_BLACK,
|
||
|
|
2
|
||
|
|
);
|
||
|
|
|
||
|
|
Element VLabel = new Text(
|
||
|
|
new Coordonnees( SVG_OFFSET, SVG_OFFSET ),
|
||
|
|
VName,
|
||
|
|
COLOR_BLACK,
|
||
|
|
AXES_TEXT_SIZE
|
||
|
|
);
|
||
|
|
Element HLabel = new Text(
|
||
|
|
new Coordonnees( SVG_SIZE - SVG_OFFSET - AXES_TEXT_SIZE, SVG_SIZE - SVG_OFFSET - AXES_TEXT_SIZE ),
|
||
|
|
HName,
|
||
|
|
COLOR_BLACK,
|
||
|
|
AXES_TEXT_SIZE
|
||
|
|
);
|
||
|
|
|
||
|
|
ArrayList<Element> SVGAxes = new ArrayList<>();
|
||
|
|
SVGAxes.add(V);
|
||
|
|
SVGAxes.add(H);
|
||
|
|
SVGAxes.add(VLabel);
|
||
|
|
SVGAxes.add(HLabel);
|
||
|
|
return SVGAxes;
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
public static ArrayList<Element> SVGAxes(){
|
||
|
|
return SVGAxes( "None", "None" );
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|