Class scilligence.JSDraw2.Drawer


class scilligence.JSDraw2.Drawer
Drawer class - draw graphics
 Example:
    <div id="div1" style="border:solid 1px gray;"></div>
    <script type="text/javascript">
        scilligence.ready(function () {
            var jsd = new JSDraw2.Editor("div1", { width: 900, height: 500, viewonly: true });
            // draw arrow
            JSDraw2.Drawer.drawArrow(jsd.surface, new JSDraw2.Point(100, 100), new JSDraw2.Point(200, 100), "red", 5);
        });
    </script>
 
Defined in Scilligence.JSDraw2.Pro.js

Function Summary
drawArrow (Point p1, Point p2, string color, number linewidth, bool dottedline, string arrowstyle)
drawArrowhead (Point p1, Point p2, string color, number linewidth, bool dottedline, string arrowstyle)
drawArrowhead2 (Point p1, Point p2, string color, number linewidth, bool dottedline, string arrowstyle)
drawBracket (Rect r, string color, number linewidth, string shape)
drawCurves (Point p1, Point p2, string color, number linewidth)
drawDShape (Rect r, string color, number linewidth, bool reverse)
drawDiamond (Rect r, string color, number linewidth)
drawDoubleArrow (Rect r, string color, number linewidth)
drawEllipse (Rect r, string color, number linewidth)
drawHexgon (Rect r, string color, number linewidth)
drawLine (Point p1, Point p2, string color, number linewidth, number dotline, bool cap)
drawPentagon (Rect r, string color, number linewidth)
drawPie (number x, number y, number radius, number deg1, number deg2, string fillcolor, string strokecolor, number linewidth)
drawRect (Rect r, string color, number linewidth, number radius, string style)
drawText2 (Point p, string s, string fontcolor, number fontsize, string rotatedeg)
drawTriangle (Point p1, Point p2, Point p3, string color)

Function Details

function drawArrow

drawArrow(Point p1, Point p2, string color, number linewidth, bool dottedline, string arrowstyle)
Parameters:
p1 - start point
p2 - end point
color
linewidth
dottedline
arrowstyle - it can be reversible, dual, solid
 Example:
     JSDraw2.Drawer.drawArrow(jsd.surface, new JSDraw2.Point(100, 100), new JSDraw2.Point(200, 100), "red", 5);
 

function drawArrowhead

drawArrowhead(Point p1, Point p2, string color, number linewidth, bool dottedline, string arrowstyle)
Parameters:
p1 - start point
p2 - end point
color
linewidth
dottedline
arrowstyle - it can be solid, double, none
 Example:
     JSDraw2.Drawer.drawArrowhead(jsd.surface, new JSDraw2.Point(100, 100), new JSDraw2.Point(200, 100), "red", 5, "double");
 

function drawArrowhead2

drawArrowhead2(Point p1, Point p2, string color, number linewidth, bool dottedline, string arrowstyle)
Parameters:
p1 - start point
p2 - end point
color
linewidth
dottedline
arrowstyle - it can be solid, top, bottom
 Example:
     JSDraw2.Drawer.drawArrowhead2(jsd.surface, new JSDraw2.Point(100, 100), new JSDraw2.Point(200, 100), "red", 5, "solid");
 

function drawBracket

drawBracket(Rect r, string color, number linewidth, string shape)
Parameters:
r - rectange
color
linewidth
shape - round, square
 Example:
     JSDraw2.Drawer.drawBracket(jsd.surface, new JSDraw2.Rect(100, 100, 200, 150), "red", 2, "square");
 

function drawCurves

drawCurves(Point p1, Point p2, string color, number linewidth)
Parameters:
p1
p2
color
linewidth
 Example:
     JSDraw2.Drawer.drawCurves(jsd.surface, new JSDraw2.Point(100, 100), new JSDraw2.Point(130, 230), "blue", 5);
 

function drawDShape

drawDShape(Rect r, string color, number linewidth, bool reverse)
Parameters:
r - rectange
color
linewidth
reverse
 Example:
     JSDraw2.Drawer.drawDShape(jsd.surface, new JSDraw2.Rect(100, 100, 130, 230), "blue");
 

function drawDiamond

drawDiamond(Rect r, string color, number linewidth)
Parameters:
r - rectangle
color
linewidth
 Example:
     JSDraw2.Drawer.drawDiamond(jsd.surface, new JSDraw2.Rect(100, 100, 200, 100), "blue", 5);
 

function drawDoubleArrow

drawDoubleArrow(Rect r, string color, number linewidth)
Parameters:
r - rectange
color
linewidth
 Example:
     JSDraw2.Drawer.drawDoubleArrow(jsd.surface, new JSDraw2.Rect(100, 100, 200, 150), "red", 2);
 

function drawEllipse

drawEllipse(Rect r, string color, number linewidth)
Parameters:
r - rectange
color
linewidth
 Example:
     JSDraw2.Drawer.drawEllipse(jsd.surface, new JSDraw2.Rect(100, 100, 130, 230), "blue");
 

function drawHexgon

drawHexgon(Rect r, string color, number linewidth)
Parameters:
r - rectangle
color
linewidth
 Example:
     JSDraw2.Drawer.drawHexgon(jsd.surface, new JSDraw2.Rect(100, 100, 200, 100), "blue", 5);
 

function drawLine

drawLine(Point p1, Point p2, string color, number linewidth, number dotline, bool cap)
Parameters:
p1
p2
color
linewidth
dotline
cap
 Example:
     JSDraw2.Drawer.drawLine(jsd.surface, new JSDraw2.Point(100, 100), new JSDraw2.Point(130, 230), "blue", 5, 3, false);
     JSDraw2.Drawer.drawLine(jsd.surface, new JSDraw2.Point(120, 100), new JSDraw2.Point(150, 230), "blue", 5, 0, false);
 

function drawPentagon

drawPentagon(Rect r, string color, number linewidth)
Parameters:
r - rectangle
color
linewidth
 Example:
     JSDraw2.Drawer.drawPentagon(jsd.surface, new JSDraw2.Rect(100, 100, 200, 100), "blue", 5);
 

function drawPie

drawPie(number x, number y, number radius, number deg1, number deg2, string fillcolor, string strokecolor, number linewidth)
Parameters:
x - center x
y - center y
radius
deg1 - start degree
deg2 - end degree
fillcolor
strokecolor
linewidth
 Example:
     JSDraw2.Drawer.drawPie(jsd.surface, 200, 200, 50, 0, 135, "blue", "red");
     JSDraw2.Drawer.drawPie(jsd.surface, 300, 200, 50, 0, 135, "blue");
     JSDraw2.Drawer.drawPie(jsd.surface, 400, 200, 50, 0, 135, null, "red", 5);
 

function drawRect

drawRect(Rect r, string color, number linewidth, number radius, string style)
Parameters:
r - rectange
color
linewidth
radius
style
 Example:
     JSDraw2.Drawer.drawRect(jsd.surface, new JSDraw2.Rect(100, 100, 130, 230), "blue", 5, 8);
 

function drawText2

drawText2(Point p, string s, string fontcolor, number fontsize, string rotatedeg)
Parameters:
p - the position
s - the text
fontcolor
fontsize
rotatedeg - rotate the text in some degree
 Example:
     JSDraw2.Drawer.drawText2(jsd.surface, new JSDraw2.Point(100, 100), "Hello, World", "red", 15, 45);
 

function drawTriangle

drawTriangle(Point p1, Point p2, Point p3, string color)
Parameters:
p1 - point 1
p2 - point 2
p3 - point 3
color
 Example:
     JSDraw2.Drawer.drawTriangle(jsd.surface, new JSDraw2.Point(100, 100), new JSDraw2.Point(200, 100), new JSDraw2.Point(200, 200), "red");