Beanshell:Setting Scale Bar options

From OpenJUMP Wiki
Jump to navigation Jump to search

Scale Bar script options adapt the scale bar

setBAR_HEIGHT(int bar_height)

setFILL1(Color fill1)

setFILL2(Color fill2)

//Predefined Colors: black, blue, cyan, darkGray, gray, green, lightGray, magenta, orange, pink, red, white, yellow

setHORIZONTAL_MARGIN(int horizontal_margin)

setLINE_COLOR(Color line_color)

setTEXT_BOTTOM_MARGIN(int text_bottom_margin)

setFONT(new Font("Dialog", Font.BOLD, 14))

//Allowed Fonts: Dialog, DialogInput, Monospaced, Serif, SansSerif //Font style: PLAIN, ITALIC, BOLD

setTEXT_COLOR(Color text_color)

setUNIT_TEXT_BOTTOM_MARGIN(int unit_text_bottom_margin)

setUNIT_TEXT_COLOR(Color unit_text_color)

setVERTICAL_MARGIN(int vertical_margin)


Example script to set Scale Bar options

{

import com.vividsolutions.jump.workbench.ui.plugin.scalebar.ScaleBarRenderer;
import java.awt.Font;
ScaleBarRenderer.setBAR_HEIGHT(13);
ScaleBarRenderer.setFILL1(Color.white);
ScaleBarRenderer.setFILL2(Color.lightGray);
ScaleBarRenderer.setTEXT_COLOR(Color.black);
ScaleBarRenderer.setFONT(new Font("Dialog", Font.BOLD, 12));
ScaleBarRenderer.setUNIT_FONT(new Font("Dialog", Font.BOLD, 12));
ScaleBarRenderer.setUNIT_TEXT_COLOR(Color.black);
ScaleBarRenderer.setVERTICAL_MARGIN(5);
ScaleBarRenderer.setHORIZONTAL_MARGIN(5);

}