Introduction
Movable and resizable graphics is presented in the
form of several programs, one library (DLL file) and some documents.
MoveGraphLibrary.DLL the library itself. Classes are
described in MoveGraphLibrary_Classes.doc. It is the current
document.
TuneableGraphics.EXE demonstrates the use of movable / resizable objects in
absolutely different areas. Description
of the program is in TuneableGraphics_Description.doc.
Test_MoveGraphLibrary.zip contains
the whole project, demonstrating the use of MoveGraphLibrary (DLL file is
included). This application demonstrates
the use of some classes from the library and the design of new class of movable
/ resizable graphical objects. The
description of the program is in Test_MoveGraphLibrary_Description.doc.
NewDesignParadigm.doc an article about the ideas and consequences of using such graphics in
complicated programs.
List of classes
All links
Application http://levd.members.winisp.net/TuneableGraphics.zip
TuneableGraphics application and its description with a lot of
pictures.
Test program http://levd.members.winisp.net/Test_MoveGraphLibrary.zip
Includes the whole project of this sample program
together with the detailed explanation of all the steps to design and use
classes of movable / resizable graphical objects. Another DOC file contains the description of
classes included into MoveGraphLibrary.dll.
Library http://levd.members.winisp.net/MoveGraphLibrary.zip
Library and the description of classes included into
it (current document).
Article http://levd.members.winisp.net/NewDesignParadigm.doc
DOC files (with one exception) are also available in
the form of HTM
http://levd.members.winisp.net/Test_MoveGraphLibrary_Description.htm
http://levd.members.winisp.net/MoveGraphLibrary_Classes.htm
http://levd.members.winisp.net/NewDesignParadigm.htm
class FullGrArea
This is the general class for plotting of y(x) or
parametric functions. The whole area
consists of the main plotting area (PureGrArea),
two scales (NumScale - one horizontal and one vertical) and title (Title). The main
line of each scale can be placed either on the border of the main plotting area
or outside; ticks and numbers of the scale can be placed on both sides of its
line, so they can appear either outside the main plotting area or inside. Title can be placed anywhere. The objects of the FullGrArea class can be made movable and resizable by adding
them to Mover.
In the current version the parameters of any FullGrArea object can be changed through calling three different
forms (one for each scale and the third one deals with the main area parameters
and the positioning of the auxiliary parts in relation to main area).
Public constructors
FullGrArea (Rectangle rc, area of the real plotting
Side sideHsc, side of horizontal scale
double fL, value on the left border
double fR, value on the right border
int
nVerGridLines, minimum number of vertical grid lines
Side sideVsc, side of vertical scale
double fT, value on the top border
double fB, value on the bottom border
int
nHorGridLines) minimum number of horizontal grid
lines
FullGrArea (Rectangle rc,
Side sideHsc, side of horizontal scale
double fL, value on the left border
double fR, value on the right border
double fXStep, grid step along horizontal scale
Side sideVsc, side of vertical scale
double fT, value on the top border
double fB, value on the bottom border
double fYStep) grid step along vertical scale
Side parameters can be one of:
enum
Side { W, N, E, S }
FullGrArea (RegistryKey regkey, string
str)
Restores the FullGrArea
that was previously saved into Registry.
To restore correctly the str parameter
must be the same as was used in IntoRegistry().
Public properties
double AnchorTitleXcoef Gets or sets the coefficient that describes the horizontal position
of the title’s center relative to the width of the plotting area.
0 means that the center will be on the left border, 1
– on the right border. Negative values
will put the title to the left of the plotting area, values bigger than 1 – to
the right.
double AnchorTitleYcoef Gets or sets the coefficient that describes the vertical position
of the title’s center relative to the height of the plotting area.
0 means that the center will be on the top border, 1 –
on the bottom border. Negative values
will put the title above the plotting, values bigger than 1 – below.
Rectangle Frame Gets the unified area of the plotting
area and those of additional areas (both scales and title) which are shown.
NumScale HorScale Gets the horizontal scale.
Side HorScaleSide Gets the horizontal scale side.
PureGrArea MainArea Gets the real plotting area.
bool ShowHorScale Gets or sets the flag to show horizontal scale.
bool ShowVerScale Gets or sets the flag to show vertical scale.
bool ShowTitle Gets or sets the flag to show title.
int SpaceToHorScale Gets or sets the space between plotting area and the line of
the horizontal scale.
int SpaceToVerScale Gets or sets the space between plotting area and the line of
the vertical scale.
Title Title Gets the title.
Point TitleAnchorPoint Gets or sets the title central point.
NumScale VerScale Gets the vertical scale.
Side VerScaleSide Gets the vertical scale side.
Public methods
FullGrArea Copy (FullGrArea
src) Constructs the identical copy of another graphical
area.
void CopyView (FullGrArea
src) Copies all view parameters from another graphical
area.
void DefineContour () Defines contour used for moving and resizing.
void Draw (Graphics grfx) Draws the main plotting area and
additional parts (scales and title), if they must be shown. The main area is the first to be drawn, so
everything else can be shown on top of it.
The main line of the scale can not move into the main area, but ticks,
numbers and labels can.
void FlipHorScale () Flips the horizontal scale to the opposite side of the
plot.
void FlipVerScale () Flips the vertical scale to the opposite side of the plot.
bool InsideHorScale (Point pt) Tests if the point is inside
horizontal scale.
bool InsideMainArea (Point pt) Tests if the point is inside main
plotting area.
bool
InsideSensitive (Point pt) Tests if the point is inside full sensitive area, that includes real plotting area plus scales and title,
but only if these additional parts are shown.
bool InsideTitle (Point pt) Tests if the point is inside title.
bool InsideVerScale (Point pt) Tests if the point is inside vertical
scale.
void
IntoRegistry (RegistryKey regkey, string str) Saves into Registry.
Method of saving information to the Registry is
closely related to the construction from Registry. To restore the same object from Registry use
constructor with the same str parameter.
void Move (int cx, int cy) Moves the full object on the defined number of pixels from
current position.
bool
MoveContourPoint (int i, int cx, int cy, Point ptM, MouseButtons
mb)
Moves one node of the contour on the
defined number of pixels from current position. Position of the mouse (ptM) and the mouse
button which was used to capture the contour point can be useful for some
movements.
void ParametersDialog
(Form formOwner, The form from which this dialog is called
OnParamForm onChanged, the
function to be executed on change of any parameter
OnParamForm onClosed, the function to be executed on
closing the parameter’s dialog
string strTitle) title of the parameter’s dialog
This is the way to open the standard dialog for
changing the parameters of the main area, for positioning of both scales and
title. Usually onChanged is doing nothing else but Invalidate() of the form in
which FullGrArea is used, and two last parameters can be set to
null. (Look into Test_MoveGraphLibrary
for an example.)
There
is a set of methods to draw y(x) function.
Methods can use:
void DrawYofX (Graphics grfx, Pen
pen, double [] fx, double
[] fy, int nDot,
SegmentLocation
nSegmentToShow)
Draws function y(x) defined by two
arrays and using the first nDot values from these arrays.
The graph is shown as a consequence of straight
segments. The last parameter defines for
each segment if it must be shown or not depending on the position of its end
points:
SegmentLocation
.Fully_Inside both points must be inside the
plotting area
SegmentLocation
.Partly_Inside at least one point is inside the
plotting area
SegmentLocation
.Any_Location points can be anywhere
void DrawYofX (Graphics grfx, int
iPen, double [] fx, double
[] fy,
int
nDot, SegmentLocation nSegmentToShow)
Draws function y(x) using one of
inside pens.
void DrawYofX (Graphics grfx, Pen
pen, ValuesOnBorders valBorders,
double
[] fx, double [] fy,
int
nDot, SegmentLocation nSegmentToShow)
Draws function y(x) using the border
values passed as parameters.
void DrawYofX (Graphics grfx, int
iPen, ValuesOnBorders valBorders,
double
[] fx, double [] fy,
int
nDot, SegmentLocation nSegmentToShow)
Draws function y(x) using the border
values passed as parameters.
void DrawYofX (Graphics grfx, Pen pen,
Delegate_DblOfDbl processFunc,
SegmentLocation
nSegmentToShow)
Draws function y(x) passed as a
delegate.
delegate double Delegate_DblOfDbl
(double fArg)
void DrawYofX (Graphics grfx, int
iPen, Delegate_DblOfDbl processFunc,
SegmentLocation
nSegmentToShow)
Draws function y(x) passed as a
delegate.
void DrawYofX (Graphics grfx, Pen
pen, Delegate_DblOfArray processFunc,
double
[] fParam, SegmentLocation nSegmentToShow)
Draws function y(x) passed as a
delegate using array of parameters.
delegate double Delegate_DblOfArray
(double fArg, double
[] param)
void DrawYofX (Graphics grfx, int
iPen, Delegate_DblOfArray processFunc,
double
[] fParam, SegmentLocation nSegmentToShow)
Draws function y(x) passed as a
delegate using array of parameters.
void DrawYofX (Graphics grfx, Pen
pen, ValuesOnBorders valBorders,
Delegate_DblOfDbl
processFunc, SegmentLocation nSegmentToShow)
void DrawYofX (Graphics grfx, int
iPen, ValuesOnBorders valBorders,
Delegate_DblOfDbl
processFunc, SegmentLocation nSegmentToShow)
There
are methods to draw parametric functions.
void
DrawParamFunc (Graphics grfx, Pen pen,
Delegate_DblOfDbl calcX, delegate
to calculate x(p)
Delegate_DblOfDbl calcY, delegate
to calculate y(p)
double fParamFrom, parameter’s starting value
double fParamTo, parameter’s end value
double fParamStep) parameter’s step
void
DrawParamFunc (Graphics grfx, int iPen,
Delegate_DblOfDbl calcX, delegate
to calculate x(p)
Delegate_DblOfDbl calcY, delegate
to calculate y(p)
double fParamFrom, parameter’s starting value
double fParamTo, parameter’s end value
double fParamStep) parameter’s step
class PureGrArea
Public constructor
PureGrArea (Rectangle rc) area of the real plotting
Public properties
Rectangle Area Gets or sets the plotting area.
Color BackColor Gets or sets the area’s back color.
Board Board Gets or sets the area’s transparency.
Board can be one of:
enum
Board { Transparent, Opaque }
Color BorderColor Gets or sets the area’s border color.
Border’s width is always 1.
DashStyle BorderDashStyle Gets
or sets the style for area’s borders.
Color HGridColor Gets or sets the horizontal grid color. Lines’ width is always 1.
DashStyle HGridDashStyle Gets
or sets the style for horizontal grid.
static int MinSize Gets the minimum size of the
area. Minimum size (now it is 50) is set
to avoid accidental disappearence of the area while resizing it.
bool PenMove
(int iFrom, int
iTo) Changes the position of the pen stored inside.
Pen [] Pens Gets or sets the pens stored inside;
there can be up to 8 pens.
bool [] ShowBorders Gets or sets the flags to show
borders. The order of flags is left,
top, right, bottom.
bool ShowHGrid Gets or sets the flag to show horizontal grid.
bool ShowVGrid Gets or sets the flag to show vertical grid.
Color VGridColor Gets or sets the vertical grid color. Lines’ width is always 1.
DashStyle VGridDashStyle Gets
or sets the style for vertical grid.
Public methods
void CopyView (PureGrArea
src) Copies all view parameters from another area.
void Draw (Graphics grfx, int []
cx_VGrid, int [] cy_HGrid)
Draws area. Grids are
drawn on coordinates sent through the parameters, but only if they have to be
shown (according with the flags).
void FromRegistry (RegistryKey regkey, string
strAdd)
void
IntoRegistry (RegistryKey regkey, string strAdd)
Pair of methods to save into and restore from
Registry. The information will be saved
in two lines:
“PureArea” + strAdd all the parameters except
array of pens
“PurePens” + strAdd the array of pens
void Move (int cx, int cy) Moves the area on the defined number of pixels from current
position.
There is a set of methods to draw y(x)
functions and parametric functions. They
use the same set of parameters as the draw functions for FullGrArea. If PureGrArea
is used as a part of FullGrArea, then these methods will be called
automatically.
void DrawYofX (Graphics grfx, Pen
pen, ValuesOnBorders valBorders,
double
[] fx, double [] fy, int
nDot, SegmentLocation nSegmentToShow)
void DrawYofX (Graphics grfx, int
iPen, ValuesOnBorders valBorders,
double
[] fx, double [] fy, int
nDot, SegmentLocation nSegmentToShow)
void DrawYofX (Graphics grfx, Pen
pen, ValuesOnBorders valBorders,
Delegate_DblOfDbl
processFunc, SegmentLocation nSegmentToShow)
void DrawYofX (Graphics grfx, int
iPen, ValuesOnBorders valBorders,
Delegate_DblOfDbl
processFunc, SegmentLocation nSegmentToShow)
void DrawYofX (Graphics grfx, Pen
pen, ValuesOnBorders valBorders,
Delegate_DblOfArray
processFunc, double [] fParam,
SegmentLocation
nSegmentToShow)
void DrawYofX (Graphics grfx, int
iPen, ValuesOnBorders valBorders,
Delegate_DblOfArray
processFunc, double [] fParam,
SegmentLocation
nSegmentToShow)
void
DrawParamFunc (Graphics grfx, Pen pen, ValuesOnBorders
valBorders,
Delegate_DblOfDbl
calcX, Delegate_DblOfDbl calcY,
double
fParamFrom, double fParamTo, double fParamStep)
void
DrawParamFunc (Graphics grfx, int iPen, ValuesOnBorders
valBorders,
Delegate_DblOfDbl
calcX, Delegate_DblOfDbl calcY,
double
fParamFrom, double fParamTo, double fParamStep)
class NumScale
This is the type of scale
which is used in FullGrArea and Histogram
(one of the scales). Each scale consists
of the main line, ticks, numbers and a label, that can be placed anywhere.
Public constructors
NumScale (double fLT, value on the left (or upper) end
double fRB, value on the right (or lower) end
int nGridLines, number of ticks
bool bAdjustLT, to adjust or not the left (top) value
to the ticks’ step
bool bAdjustRB, to adjust or not the right (bottom)
value with the ticks’ step
Point pt0, left (top) point of the line
Point pt1, right (bottom) point of the line
Side sideticks, side of ticks
TextBasicPoint cntr, center of rotation for each number; shifts
are defined to this center
int cxShift,
horizontal shift from the tick to the
center of number rotation
int cyShift, vertical shift from the tick to the
center of number rotation
int angle) numbers’ angle
NumScale (double fLT, value on the left (or upper) end
double fRB, value on the right (or lower) end
double fStep, ticks’ step
bool bAdjustLT, to adjust or not the left (top) value
to the ticks’ step
bool bAdjustRB, to adjust or not the right (bottom)
value with the ticks’ step
Point pt0, left (top) point
Point pt1, right (bottom) point
Side sideticks, side of ticks
TextBasicPoint cntr, center of rotation for each number; shifts
are defined to this center
int cxShift, horizontal shift from the tick to the
center of number rotation
int cyShift, vertical shift from the tick to the
center of number rotation
int angle) numbers’ angle
Basic point of rotation can be one of:
enum TextBasicPoint { NW, N, NE, W, M, E, SW, S, SE };
Eight values here are obvious from abbreviation and M
means middle point of the string.
Four last parameters are
for positioning of the numbers along the scale.
The use (and meaning) of these parameters will be pretty obvious from
the moment you’ll start moving the sample number in any form (dialog) for
tuning of scale’s parameters. You move
the sample number, and all the numbers of the scale are moved at the same time. There are nine colored markes: four corners
plus for middle points of the sides plus the middle of the string. One of the marks is always shown in red – it
is the center of rotation, others are shown in violet. The shifts are between the base of the tick
and the red point. To move all the numbers
use L_Press on any of the marks. To rotate the numbers use R_Press, but in
this case you don’t need even to press the mark but anywhere inside the colored
frame. If you use L_Press, then the
position of this mark is used for shifts calculations. The explanation is much longer (and more
confusing) than the use of those marks.
Numbers along the scale can be of different length (for example, you
have [0, 10000] with the step of 500),
and these marks allow you to line the numbers in different ways.
Public properties
bool AdjustLT Gets or sets the flag to adjust or not the left (top)
value.
bool AdjustRB Gets or sets the flag to adjust or not the right
(bottom) value.
These two
parameters allow either to use the defined end values or to adjust them to the
grid step.
int DecPlaces Gets or sets the number of decimal places while
showing the numbers.
Point [] EndPoints Gets or sets end points.
string [] EndValuesInDefinedFormat Gets the end values in the same format as used on the scale.
Rectangle Frame Gets the scale area. Can not be obtained prior to the first
drawing.
GridOrigin GridOrigin Gets or sets the way to calculate
grids. It can be either GridOrigin
.ByStep or GridOrigin
.ByMinLines
double GridStep Gets or sets the grid’s step. It must be non zero.
string Label Gets or sets the label’s text.
double LabelAlongCoef Gets
or sets the coefficient, that is used only for positioning the label along the
line when label’s center is between the end points. Only the values from [0, 1] range are used
for calculations.
int LabelAngle Gets or sets the label’s angle; positive numbers are going counter clock.
Color LabelColor Gets or sets the label’s color.
int LabelFixedShift Gets
or sets the label’s shift to the nearest end of the line, when the center of the
label is outside the line’s segment. For
position of the label to the left (or above) the value is negative, to the
right (or below) – positive.
Font LabelFont Gets or sets the label’s font.
LabelPositioning LabelPositioning Gets or sets label’s positioning.
Label can be placed
anywhere along the scale, but because the scale itself can change the size,
different techniques are used for placing the label outside of the line or
inside its segment. While outside the
fixed shift is used, so even with the change of the scale’s length the label
will stay in the same relative position.
While inside the proportional placement is used.
int LabelSideShift Gets
or sets the label’s shift to the side of the main line. Calculated in pixels between the center of the
label and the main line.
Three different parameters
are used for label’s positioning, and it is easy to use the tuning form, but
the explanation can be confusing. The
sample of the label will be shown in the same sample area as for numbers, but
this sample is in view only if you give the label some value (any text). In this case there will be the blue spot in
the middle of the sample, grab it with the mouse and move around, thus moving
the label of the real scale.
Color LineColor Gets or sets the color of the main line and ticks.
LineDir LineDirection Gets line’s direction (either LineDir.Hor
or LineDir.Ver)
int LineLength Gets line’s length.
LinesLabel LinesLabel Gets or sets the label.
int MinGridLines Gets
or sets the minimum number of ticks. It
must be >= 2.
Usually you know the range
of values and can set the good grid step so, that the grid will be helpful and
there would be not too many additional lines across the plotting area. In case of the unknown range it is better to
declare the minimum number of grid lines, and the program will define the good
grid step (good for analysing the plot) with the number of lines either equal
or slightly bigger than the defined number.
Point PointLT Gets or sets the left (top)
point. It can be only on the same existing
line and the new scale length must be not less than the minimum allowed size
(>= 50).
Point PointRB Gets or sets the right (bottom)
point. It can be only on the same existing
line and the new scale length must be not less than the minimum allowed size
(>= 50).
TextBasicPoint RotationCenter Gets the basic point for rotation.
int RotCenterXshift Gets or sets the horizontal shift of the numbers from the
ticks.
int RotCenterYshift Gets or sets the vertical shift of the numbers from the
ticks.
bool ShowInnerTicks Gets or sets the flag to show inner ticks.
bool ShowEndTicks Gets or sets the flag to show end ticks.
bool ShowLine Gets or sets the flag to show the main line.
bool ShowNumInner Gets or sets the flag to show numbers next to inner
ticks.
bool ShowNumLT Gets or sets the flag to show the value on the left
(top) end.
bool ShowNumRB Gets or sets the flag to show the value on the right
(bottom) end.
int SubIntervals Gets or sets the number of intervals for subticks
between two consecutive ticks. 1 means
that there would be no subticks; the maximum number of intervals is 10.
int SubTicksLen Gets or sets the length of the subticks. Subticks can not be longer than ticks.
int TextsAngle Gets or sets the angle of the numbers; positive angles are going counter
clock.
Color TextsColor Gets or sets the color of the scale’s numbers.
Font TextsFont Gets or sets the numbers’ font.
int TicksLen Gets or sets the ticks’ length.
Side TicksSide Gets the ticks’ side.
double ValueLT Gets or sets the left (top) value.
double ValueRB Gets or sets the right (bottom) value.
double [] Values Gets or sets both end values. For setting the array must consist of two
different values.
Public methods
void AdjustEnds
(bool AdjustLT, bool
AdjustRB)
Sets types of adjustment for both ends.
void CopyLabelParams (NumScale src) Copies the group of parameters that
determine label’s view.
void CopyLineParams (NumScale src) Copies the group of parameters that
determine line and ticks.
void CopyNumParams (NumScale src) Copies the group of parameters that
determine numbers’ view.
void CopyPhysParams (NumScale src) Copies the group of parameters which
are “physical”. That includes two end
values, grid step, minimum number of grid lines, the type of grid calculation
(either from step or from minimum number of grid lines) and two flags for
adjusting or not the end values.
void CopyView
(NumScale src) Copies all view parameters from
another scale.
void Draw (Graphics grfx) Draws the scale.
void FlipTicks
() Flips the ticks to another side.
void FlipNumbers () Flips the numbers to the opposite side of the main line; angle will
be the same, but the shifts will be calculated to another basic point (the
change of basic point differs for horizontal and vertical scales).
void FromRegistry
(RegistryKey regkey, string
strAdd)
Restores from Registry.
int [] GetTickCoordinates
() Returns the array of coordinates, corresponding to the
ticks. For horizontal scale it would be
x [ ], for vertival scale – y [ ].
bool Inside
(Point pt) Checks if the point is inside the
scale.
void IntoRegistry
(RegistryKey regkey, string
strAdd)
Saves into Registry.
The information will be saved in four lines:
“PhysSc_” + strAdd “physical” parameters
“LineSc_” + strAdd all line’s parameters
“TextNumSc_” + strAdd all parameters related to numbers
“LabelSc_” + strAdd all label’s parameters
void MirrorLabel () Mirrors the label to the opposite side of the main
line. Because we usually prefer to read
from left to right this method works differently for horizontal and vertical scales.
void Move (int cx,
int cy) Moves the scale on the defined number
of pixels from current position.
bool MoveContourPoint
(int i, int cx,
int cy, Point
ptM, MouseButtons catcher)
Moves one node of the contour on the
defined number of pixels from current position.
void
ParametersDialog (Form formOwner, The form from which this dialog is
called
OnParamForm onChanged, the
function to be executed on change of any parameter
OnParamForm onClosed, the function to be executed on closing
the parameter’s dialog
string strTitle) title of the parameter’s dialog
This is the way to open the standard dialog for
changing the parameters of NumScale. Usually onChanged is
doing nothing else but Invalidate() of the form in which FullGrArea with this NumScale is
used, and two last parameters can be set to null. (Look into Test_MoveGraphLibrary for an
example.)
bool SetEndPoints
(Point ptLT, Point
ptRB, Side sdTicks)
Sets both end points and side for ticks. Not only the points must define either
horizontal or vertical line, but the last parameter must agree with this line
direction. For example, if ptLT.X ==
ptRB.X (vertical line),
then the side can be either Side.W or Side.E.
void SetPhysTrio
(double fLT, double
fRB, double step)
Sets both end values and the step. End values must be different.
void SetRotationCenter
(TextBasicPoint cntr, int
cx, int cy)
Sets the basic point for numbers
rotation and the shifts to this point.
bool SwapEndValues
() Swaps end values.
class Title
Object of this class is
included into nearly every class of scientific or financial graphics (FullGrArea, Histogram, PieChart).
Public constructors
Title (Point ptAnchor) Anchor point of the Title is the middle
point of the text
Title (Point ptAnchor, int angle) Angle in degrees (positive goes
counter clock).
Title (Point ptAnchor, int
angle, Font fnt)
Title (Point ptAnchor, int
angle, Font fnt, Color
color, string txt)
Public properties
Point Anchor Gets or sets the anchor point.
int Angle Gets or sets the text’s angle.
Color Color Gets or sets the text’s color.
Font Font Gets or sets the font.
Rectangle Frame Gets the Title’s area
string Text Gets or sets the text.
Public methods
void Copy (Title src) Copies everything.
void CopyWithoutPoint
(Title src) Copies everything except anchor point.
void Draw (Graphics grfx) Draws the Title.
void FromRegistry (RegistryKey regkey, string
strAdd)
void
IntoRegistry (RegistryKey regkey, string strAdd)
Pair of methods to save into and restore from
Registry. The information will be saved
in the line “Title_” + strAdd
void Move (int cx, int cy) Moves the Title on the defined number of pixels from current
position.
struct ValuesOnBorders
Public constructor
ValuesOnBorders (double
fLeft, double fRight, double
fTop, double fBtm)
Sets values on four borders
Public properties
double Bottom Gets the value on the bottom border.
double Left Gets the value on the left border.
double Right Gets the value on the right border.
double Top Gets the value on the top border.
class Mover
This is the class to implement all moving and resizing
features for graphical objects and controls.
Any object is turned into MovableObject,
and Mover contains the List<MovableObject>, so public methods of this class are very similar to the methods
of standard List<>. Objects
included into Mover can be reached via standard indexing [].
Public constructors
Mover ()
Public properties
MouseButtons Catcher Gets the button which caught the contour. It is useful in case of different movements
as the reaction on pressing left and right mouse buttons.
int Color Gets or sets the color of the frames
around movable objects. Each movable
object may have its own color of the frame, but this property will unify them.
int Count Gets the number of included elements.
int CaughtObject Gets the index of the caught element.
bool MoverCaught Gets or sets the flag indicating whether any MovableObject is caught or not.
Several properties for situation when mouse cursor is
moving across the screen, but no object was caught.
bool MoverSensed Gets the flag indicating whether any node or
connection is under cursor.
bool NodeSensed Gets the flag indicating whether any node is under
cursor.
int SensedMover Gets the number of the sensed MovableObject.
int SensedNode Gets the number of the sensed node.
Public methods
void Add (Control
control) Adds control to the list of elements.
void Add (GraphicalObject grobj) Adds the
new GraphicalObject
element.
void Add (MovableObject movobj) Adds the new MovableObject element.
void CatchMover
(Point ptMouse) Catches one of the included elements
if the point is in the sensitive area of the element. Usually used inside MouseDown event. In this case of not specified MouseButtons the default MouseButtons
.Left is used.
void CatchMover
(Point ptMouse, MouseButtons
mb)
Catches one of the included elements
if the point is in the sensitive area.
Usually used inside MouseDown event.
void Clear () Clears the List of movable objects.
void DrawContours (Graphics grfx) Draws contours around all included movable
objects.
void Insert (int
iPos, Control control) Inserts
control.
void Insert (int
iPos, GraphicalObject grobj) Inserts GraphicalObject.
void Insert (int
iPos, MovableObject movobj) Inserts MovableObject.
void
MovingMover (Point ptMouse) If any element on the Mover is caught, then moving this element;
otherwise changing the cursor in case the mouse is in the sensitive area of any
element. This method is used inside
MouseMove event.
void ReleaseMover () Releases the Mover.
void RemoveAt (int
iPos) Removes the element from the List.
void Reverse (int iPos, int nNum) Reverses the order of the included elements thus changing the
order of their appearence on the screen.
class Histogram
This is the class for plotting histograms. The whole plotting area consists of the main
area in which the real plotting is done (HistoDrawArea),
two scales (one NumScale and one TextScale which
are perpendicular to each other) and title (Title). The colored strips are always going along the
NumScale but any direction can be selected by histogram
rotation. The main line of each scale
can be placed either on the border of the main plotting area or outside; ticks,
numbers and texts can be placed on both sides of the lines, so they can appear
either outside the main plotting area or inside. Title can be placed anywhere. The objects of the Histogram class can be made movable and resizable by adding
them to Mover.
In the working application the parameters of any Histogram object can be changed through calling three different
forms (one for each scale and the third one deals with the main area parameters
and the positioning of the auxiliary parts in relation to main area).
Public constructors
Histogram (Rectangle rc, area of the real plotting
Side sideTexts, side of arguments’ scale (TextScale)
string [] txts, texts for each segment
TextsDrawingDirection drawDir, direction of
drawing
Side sideNums, side of values’ scale (NumScale)
double fLT, value on the left (top) border
double fRB, value on the right (bottom) border
double fStep) grid step along values’ scale
Histogram (RegistryKey
regkey, string str)
Restores the Histogram that was previously saved into Registry. To restore correctly the str parameter must be the same as was used in
IntoRegistry().
Public properties
double AnchorTitleXcoef Gets or sets the coefficient that describes the horizontal position
of the title’s center relative to the width of the plotting area.
0 means that the center will be on the left border, 1
– on the right border. Negative values
will put the title to the left of the plotting area, values bigger than 1 – to
the right.
double AnchorTitleYcoef Gets or sets the coefficient that describes the vertical position
of the title’s center relative to the height of the plotting area.
0 means that the center will be on the top border, 1 –
on the bottom border. Negative values
will put the title above the plotting, values bigger than 1 – below.
double BaseLevel Gets or sets the base level of drawing. If it is inside the range of values’ scale
then the drawing of colored strips will be done to both sides of this level.
double ColoredPart Gets the part of drawing segment that will be used by
colored strips. It is inside [0, 1].
Rectangle Frame Gets the summarized area of the
plotting area and those of additional areas (both scales and title) which are
shown.
HistoDrawArea MainArea Gets the real plotting area.
NumScale NumScale Gets the values’ scale.
Side NumScaleSide Gets the values’scale side.
int Segments Gets the number of segments.
int Sets Gets the number of sets.
bool ShowNumScale Gets or sets the flag to show values’scale.
bool ShowTextScale Gets or sets the flag to show arguments’scale.
bool ShowTitle Gets or sets the flag to show title.
int SpaceToNumScale Gets or sets the space between plotting area and the line of
the values’scale.
int SpaceToTextScale Gets or sets the space between plotting area and the line of
the arguments’scale.
double StartSpace Gets the space at the beginning of each drawing
segment. It is inside [0, 1].
TextsDrawingDirection
TextsDrawingDirection
Gets or sets the direction of drawing. It can be either left-to-right
(top-to-bottom) or opposite.
TextScale TextScale Gets the arguments’ scale.
Side TextScaleSide Gets the arguments’scale side.
Title Title Gets the title.
Point TitleAnchorPoint Gets or sets the title central point.
double [] Values Gets the array of values that are
used for drawing.
Public methods
Histogram Copy (Histogram
src) Constructs the identical copy of another Histogram.
void CopyView (Histogram
src) Copies all view parameters from
another Histogram.
void DefineContour () Defines contour.
void Draw (Graphics grfx) Draws with all predefined values.
void Draw (Graphics
grfx, Draws with the new sets of values.
int sets,
double [] values)
Each set of values is shown in its own color. Number of values in the array can not be less
than sets*nSegments. The array of
values must be organized in such a way: A {0,1, … nSegments-1}, B {0, 1, …
nSegments-1} and so on. The first
segment will show A[0], B[0], …; the second segment will show A[1], B[1], …
void Draw (Graphics
grfx, Draws with the new texts and sets of
values.
string [] txts)
int
sets,
double [] values)
bool
FillCoefficients (double fSpace, double fClrs)
Sets the space at the beginning of
each segment and the part of segment that will be used by colored strips. Must be fSpace>=0, fClrs>0, fSpace +
fClrs <= 1.
void FlipNumScale () Flips the values’scale to the opposite side of the plot.
void FlipTextScale () Flips the arguments’scale to the opposite side of the plot.
bool InsideMainArea (Point pt) Tests if the point is inside real
plotting area.
bool InsideNumScale (Point pt) Tests if the point is inside values’
scale.
bool
InsideSensitive (Point pt) Tests if the point is inside full sensitive area, that includes real plotting area plus scales and title,
but only if these additional parts are shown.
bool InsideTextScale (Point pt) Tests if the point is inside arguments’
scale.
bool InsideTitle (Point pt) Tests if the point is inside title.
void
IntoClipboard (CopyPart copypart, CopyBackType backtype)
Copies Histogram into clipboard. First parameter defines the part to copy (PurePlot or FullPlotArea), the second allows to switch from the
original background (Original) to white (WhitePaper).
void
IntoRegistry (RegistryKey regkey, string str) saving into Registry
Method of saving information to the Registry is
closely related to the construction from Registry. To restore the same object from Registry use
constructor with the same str parameter.
void Move (int cx, int cy) Moves the full object on the defined number of pixels from
current position.
bool MoveContourPoint
(int i, int cx,
int cy, Point
ptM, MouseButtons mb)
Moves one node of the contour on the
defined number of pixels from current position.
void
ParametersDialog (Form formOwner, The form from which this dialog is
called
OnParamForm onChanged, the
function to be executed on change of any parameter
OnParamForm onClosed, the function to be executed on
closing the parameter’s dialog
string strTitle) title of the parameter’s dialog
This is the way to open the standard dialog for
changing the parameters of the main area, for positioning of both scales and
title. Usually onChanged is doing nothing else but Invalidate() of the form in
which Histogram is used, and two last parameters can be set to null.
bool ResetScales (Side sideTexts, TextScale
textScale_new, Side sideNums, NumScale numScale_new)
This is the only way to change the scales’ orientation
while rotating histogram. It can not be
done in two separate steps as two scales must be always perpendicular.
void SetColor (int
i, Color clr) Sets one of the shown colors.
void SetValue (int
i, double val) Sets one of the shown values.
void SetValues (int i, double [] vals) Sets the number of sets (different colors) and all the values.
class HistoDrawArea
Public constructor
HistoDrawArea (Rectangle rc) area of the real histogram plotting
Public properties
Rectangle Area Gets or sets the plotting area.
Color ArgGridColor Gets or sets the arguments’ grid color. Lines’ width is always 1.
DashStyle ArgGridDashStyle Gets
or sets the style for arguments’ grid.
Color BackColor Gets or sets the area’s back color
Color BorderColor Gets or sets the area’s border color.
Border’s width is always 1.
DashStyle BorderDashStyle Gets
or sets the style for area’s borders.
Board Board Gets or sets the area’s transparency.
Board can be one of:
enum
Board { Transparent, Opaque }
int ColorCount Gets the number of stored colors.
Color [] Colors Gets or sets the colors stored
inside; number of colors is not limited.
static int MinSize Gets the minimum size of the
area. Minimum size (now it is 50) is set
to avoid accidental disappearence of the area while resizing it.
bool ShowArgGrid Gets or sets the flag to show arguments’ grid.
bool [] ShowBorders Gets or sets the flags to show
borders. The order of flags is left,
top, right, bottom.
bool ShowValGrid Gets or sets the flag to show values’ grid.
Color ValGridColor Gets or sets the values’ grid color. Lines’ width is always 1.
DashStyle ValGridDashStyle Gets
or sets the style for values’ grid.
Public methods
Several methods to work with the colors stored inside
Histogram.
void ColorAdd (Color
clrNew) Adds the color.
bool ColorChange (int i, Color clr) Changes the color.
void ColorClear () Clears list of colors.
bool ColorInsert (int i, Color clr) Inserts new color.
bool ColorMove (int iFrom, int iTo) Moves the color from one position to another.
bool ColorRemoveAt (int iPos) Removes the color.
bool
ColorReverse (int iPos, int nNum) Reverses the colors.
void CopyView (Histogram
src) Copies all view parameters from
another Histogram.
void Draw (Graphics
grfx,
Side sideText, side of arguments’ scale
int nSegment, number of segments (arguments)
TextsDrawingDirection
textDrawDir, drawing direction
Side sideNum, side of values’ scale
int [] nCoor) coordinates for values’ grid
void
DrawHistogram (Graphics grfx,
double
[] values,
int
nSets,
int
nElemInSet,
double
fBaseLevel,
Side
sideStart,
ValuesOnBorders
valBorders,
double
fStartSpace,
double
fInfoPart)
This method of drawing histogram is called from within
Histogram.Draw(), so the first four parameters are coming from that
call; others are organized inside Histogram.
void FromRegistry (RegistryKey regkey, string
strAdd) Restores from Registry.
void
IntoRegistry (RegistryKey regkey, string str) Saves into Registry.
void Move (int cx, int cy) Moves the area on the defined number of pixels from current
position
class TextScale
This is the type of scale
which is used with Histogram (and other types of “financial” graphics). There is some closeness to NumScale,
but there are also differences. In NumScale
the numbers are anchored to the ticks; here the scale is divided into segments
and the texts are anchored to the centers of segments. The new parameter here (not used in NumScale)
is the direction of drawing. Each scale
consists of the main line, ticks, texts and a label, that can be put anywhere.
Public constructors
TextScale (string [] txts, texts for the scale
Point pt0, left (top) point of the line
Point pt1, right (bottom) point of the line
Side sideticks, side of ticks
TextBasicPoint cntr, center of rotation, to which shifts
are defined
int cxShift, horizontal shift to the center of
rotation
int cyShift, vertical shift to the center of
rotation
int angle) texts’ angle
Public properties
TextScale Clone Gets the identical TextScale.
Point [] EndPoints Gets or sets both end points.
Rectangle Frame Gets the scale area. Can not be obtained prior to the first
drawing.
string Label Gets or sets the label’s text.
double LabelAlongCoef Gets
or sets the coefficient, that is used only for positioning the label along the
line when label’s center is between the end points. Only the values from [0, 1] range are used
for calculations.
int LabelAngle Gets or sets the label’s angle; positive angles are going counter clock.
Color LabelColor Gets or sets the label’s color.
int LabelFixedShift Gets
or sets the label’s shift to the nearest end of the line, when the center of
the label is outside the line’s segment.
For position of the label to the left (or above) the value is negative,
to the right (or below) – positive.
Font LabelFont Gets or sets the label’s font.
LabelPositioning LabelPositioning Gets or sets label’s positioning.
Label can be placed
anywhere along the scale, but because the scale itself can change the size,
different techniques are used for placing the label outside of the line or
inside its segment. While outside the
fixed shift is used, so even with the change of the scale’s length the label
will stay in the same relative position.
While inside the proportional placement is used.
int LabelSideShift Gets
or sets the label’s shift to the side of the main line. Calculated in pixels between the center of
the label and the end of the main line.
Three different parameters
are used for label’s positioning, and it is easy to use the tuning form, but
the explanation can be confusing. The
sample of the label will be shown in the same sample area as for texts, but
this sample is in view only if you give the label some value (any text). In this case there will be the blue spot in
the middle of the sample, grab it with the mouse and move around, thus moving
the label of the real scale.
LineDir LineDirection Gets line’s direction (either LineDir.Hor
or LineDir.Ver)
Color LineColor Gets or sets the color of the main line and ticks.
int LineLength Gets line’s length
LinesLabel LinesLabel Gets or sets the label.
Point PointLT Gets or sets the left (top)
point. It can be only on the same existing
line and the new scale length must be not less than the minimum allowed size
(>= 50).
Point PointRB Gets or sets the right (bottom)
point. It can be only on the same existing
line and the new scale length must be not less than the minimum allowed size
(>= 50).
TextBasicPoint RotationCenter Gets the basic point for rotation.
int RotCenterXshift Gets or sets the horizontal shift of the texts.
int RotCenterYshift Gets or sets the vertical shift of the texts.
int Segments Gets the number of segments.
bool ShowLine Gets or sets the flag to show main line.
bool ShowTexts Gets or sets the flag to show the texts.
bool ShowTicks Gets or sets the flag to show the ticks.
string [] Texts Gets or sets the texts.
TextsDrawingDirection
TextsDrawingDirection
Gets or sets the direction of drawing. Possible values are:
enum TextsDrawingDirection
{ LTtoRB, RBtoLT }
int TextsAngle Gets or sets the angle of the texts; positive numbers are going counter
clock.
Color TextsColor Gets or sets the texts’ color.
Font TextsFont Gets or sets the texts’ font.
int TicksLen Gets or sets the ticks’ length.
Side TicksSide Gets the ticks’ side.
Public methods
void CopyLabelParams (TextScale src) Copies the label’s parameters.
void CopyLineParams (TextScale src) Copies the parameters for line and
ticks.
void CopyTextParams (TextScale src) Copies the parameters for texts.
void CopyView (TextScale
src) Copies all view parameters from
another scale.
void Draw (Graphics grfx) Draws the scale.
void FlipTextsDrawingDirection () Flips drawing direction.
void FlipTexts
() Flips the texts to the
opposite side of the main line; angle will be the same, but the shifts will be
calculated to another basic point (the change of basic point differs for
horizontal and vertical scales).
void FlipTicks () Flips the ticks to another side.
void FromRegistry (RegistryKey regkey, string
strAdd)
Restores from Registry.
bool Inside (Point
pt) Checks if the point is inside the
scale.
void IntoRegistry (RegistryKey regkey, string
strAdd)
Saves into Registry.
The information will be saved in four lines:
“LineTxsc_” + strAdd all line’s parameters
“TxparTxsc_” + strAdd all parameters related to texts
“TextsTxsc_” + strAdd texts themselves
“LabelTxsc_” + strAdd all label’s parameters
void
MirrorLabel () Mirrors the label to the opposite
side of the main line. Because we
usually prefer to read from left to right this method works differently for
horizontal and vertical scales.
void Move (int cx, int cy) Moves the scale on the defined number of pixels from current
position.
bool MoveContourPoint (int i, int cx, int cy, Point ptM, MouseButtons catcher)
Moves one node of the contour on the
defined number of pixels from current position.
void
ParametersDialog (Form formOwner, The form from which this dialog is
called
OnParamForm onChanged, the
function to be executed on change of any parameter
OnParamForm onClosed, the function to be executed on
closing the parameter’s dialog
string strTitle) title of the parameter’s dialog
This is the way to open the standard dialog for
changing the parameters of TextScale. Usually onChanged is
doing nothing else but Invalidate() of the form in which, for example, Histogram with this TextScale is
used, and two last parameters can be set to null.
bool SetEndPoints (Point ptLT, Point
ptRB, Side sdTicks)
Sets both end points and side for ticks. Not only the points must define either
horizontal or vertical line, but the last parameter must agree with this line
direction. For example, if ptLT.X ==
ptRB.X (vertical line),
then the side can be either Side.W or Side.E.
void SetRotationCenter (TextBasicPoint cntr, int
cx, int cy)
Sets the basic point for texts
rotation and the shifts to this point.
class LinesLabel
This is the label that is
used with any scale (NumScale or TextScale). Label’s positioning is done in relation to
the line. The side shift is always done
in pixels; positioning along the line is either proportional (when the label is
inside the line’s segment) or determined in pixels (when outside the segment).
Public constructors
LinesLabel (int angle) Labels’ angle
Public properties
string Label Gets or sets the text.
double AlongCoef Gets or sets the coefficient, that is
used only for positioning the label when its center is between the end points
of the line. Only the values from [0, 1]
range are used for calculations.
int Angle Gets or sets the angle; positive
numbers are going counter clock.
Color Color Gets or sets the color.
int FixedShift Gets or sets the label’s shift to the nearest end of the line, when the
center of the label is outside the line’s segment. For position of the label to the left (or
above) the value is negative, to the right (or below) – positive.
Font Font Gets or sets the label’s font.
LabelPositioning Positioning Gets or sets the positioning.
Label can be placed
anywhere along the scale, but because the scale itself can change the size,
different techniques are used for placing the label outside of the line or
inside its segment. While outside the
fixed shift is used, so even with the change of the scale’s length the label
will stay in the same relative position.
While inside the proportional placement is used.
int SideShift Gets or sets the shift to the side of the main line. Calculated in pixels between the center of
the label and the main line.
Public methods
void Copy (LinesLabel
src) Copies the parameters from another
label.
void Draw (Graphics grfx, Point
pt_LT, Point pt_RB, out
Rectangle rc)
Draws the label. Two points are the line’s ends; this method
also calculates the frame of the label.
void FromRegistry (RegistryKey regkey, string
name) Restores from Registry.
void IntoRegistry (RegistryKey regkey, string
name) Saves into Registry.
void Mirror () Mirrors the label to the opposite
side of the line. Because we usually
prefer to read from left to right this method works differently for horizontal
and vertical scales.
void Rotate (Rotation rotation, LineDir
lineDir)
Rotates the label. The results depend on line’s direction.
class PieChart
One of the classes for
“financial” plotting. Consists of the
circle divided into sectors and a title.
Each sector may have its own text, positioned independantly.
Public constructors
PieChart (Point ptC, Center of the circle
int nRad, circle’s radius
double [] values, array of values
string [] labels, sector
s’ texts (can be null)
Font fnt) font for these texts
PieChart (RegistryKey regkey,
string str)
Restores the PieChart that was previously saved into Registry. To restore correctly the str parameter must be the same as was used in
IntoRegistry().
Public properties
int AdditionalTitleRadius Gets or sets the shift of title’s center from the circle’s
border. The title is positioned by its
center in relation to the border of the circle; positive numbers are for
outside positions, negative – for inside the circle.
Color BorderColor Gets or sets the border’s color. Border’s width is always 1. The same color is used for circle’s border
and for sectors’
borders.
Point Center Gets the center of the circle.
Color [] Colors Gets or sets colors.
bool FixedTextAngle Gets or sets the flag to fix the angles of all sectors’ texts or change them according
with the rotation.
Rectangle Frame Gets the unified area of the circle, sectors’ texts and title.
int Radius Gets or sets the radius.
Rectangle RectAroundCircle Gets the rectangle around circle.
Rotation Rotation Gets or sets the direction of sectors’ drawing. It can be one of
enum Rotation {
Clockwise, Counterclock };
int Sectors Gets the number of sectors.
bool ShowBorders Gets or sets the flag to show borders of the circle and of all the sectors.
bool ShowPercent Gets or sets the flag to add or not the percent to sectors’ texts.
bool ShowTexts Gets or sets the flag to show sectors’ texts.
bool ShowTitle Gets or sets the flag to show title.
int StartingAngle Gets or sets the starting angle, from which the drawing
starts; positive angles are going counter clock.
double [] StartingAngles Gets the starting angles of all the sectors.
double [] SweepingAngles Gets the sweeping angles of all the sectors.
string [] Texts Gets sectors’ texts.
Color TextsColor Gets or sets the color for sectors’ texts.
Font TextsFont Gets or sets the font for sectors’ texts.
Title Title Gets the title.
int TitleMarkAngle Gets or sets the angle of title’s center; positive angles are
going counter clock.
double [] Values Gets or sets the array of values that
are used for drawing.
Public methods
void ChangeRotation () Changes the direction of drawing (clockwise or
counterclock).
bool ColorChange (int i, Color clr) Changes the color.
bool ColorMove (int iFrom, int iTo) Moves the color from one position to another.
void DrawPurePlot (Graphics grfx) Draws only colored circle.
void Draw (Graphics grfx) Draws colored circle, segments’ texts and title.
bool InsideMainArea (Point pt) Tests if the point is inside the
circle.
void IntoClipboard (CopyPart copypart)
Copies PieChart into clipboard. First parameter defines the part to copy (PurePlot or FullPlotArea); it is either colored circle or
everything.
void IntoRegistry (RegistryKey regkey, string
str) saving into Registry
Method of saving information to the Registry is
closely related to the construction from Registry. To restore the same object from Registry use
constructor with the same str parameter.
TextBasicPoint
LabelBasicPoint (int i) Gets the
basic point for text rotation of the particular sector.
void Move (int cx, int cy) Moves the PieChart on the defined number of pixels from
current position.
bool MoveContourPoint (int i, int cx, int cy, Point ptM, MouseButtons catcher)
Moves one node of the contour on the
defined number of pixels from current position.
void
ParametersDialog (Form formOwner, The form from which this dialog is
called
OnParamForm onChanged, the
function to be executed on change of any parameter
OnParamForm onClosed, the function to be executed on
closing the parameter’s dialog
string
strTitle) title of the parameter’s dialog
This is the way to open the standard dialog for
changing the parameters of PieChart. Usually onChanged is
doing nothing else but Invalidate() of the form in which PieChart is used, and two last parameters can be set to null.
void SetText (int
i, string txt) Sets one of segments’ texts.
void SetTextRotationParam_AddRadius (int iSector, int
nAddRadius)
Sets an additional radius for the
center of text of the particular sector.
void SetTextRotationParam_BasicPoint (int iSector, TextBasicPoint
basicpoint)
Sets the basic point for text
rotation of the particular sector.
void
SetTextRotationParam_RotCenterAngle (int
iSector, int angle)
Sets the angle for the center of text
of the particular sector.
void SetTextRotationParam_TextAngle (int iSector, int
angle)
Sets the angle for the text of the
particular sector.
void SetValue (int
i, double val) Sets one of the values.
int TextAngle (int i) Gets the angle of the text for
particular sector.
void TextRotationParams (int iSector, Gets all the parameters for the text
of the particular sector.
out TextBasicPoint
basicpoint,
out int
nRotCenterAngle,
out int nAddRadius,
out int nTxtAngle)
class Skyscrapers
One of the classes for
“financial” plotting. Can be used only
on top of XYZcoordinates.
Public constructors
Skyscrapers
(SkyscrapersDrawing order, int rows, double []
values)
Skyscrapers
(SkyscrapersDrawing order, double [,] values)
Skyscrapers are shown as the collection of towers
lined in rows and columns. If the values
are defined in the form of one-dimensional array, then number of rows must be
specified; the two dimensional array doesn’t need this additional parameter. Minimum number of rows or columns equal 2.
The first parameter defines the axis along which the
drawing of towers is done; usually XYZ coordinates are shown with X axis on the
left, Y axis on the right and Z axis going up.
enum SkyscrapersDrawing { AlongX, AlongY };
Public properties
double AcrossRowCoef Gets or sets the filling coefficient (density) across the rows. Can be inside [0.2, 1].
Size AnchorToRotCenter_Left Gets or sets the shift from anchor point to the rotation
center of the left texts. Anchor point
is in the middle of the segment on the side line parallel to Y axis.
Size AnchorToRotCenter_Right Gets or sets the shift from anchor point to the rotation
center of the right texts. Anchor point
is in the middle of the segment on the side line parallel to X axis.
Color ColorEdges
Gets or sets the edges’ color.
Color ColorNumbers
Gets or sets the numbers’ color.
Color ColorTextCols
Gets or sets the color of texts for the columns.
Color ColorTextRows
Gets or sets the color of texts for the rows.
int Cols
Gets number of columns.
string [] ColsTexts Gets or sets the texts for columns. New texts will be set only if the number of
strings in the array is equal to the number of columns.
SkyscrapersDrawing DrawOrder Gets or sets the drawing order.
Font FontNumbers
Gets or sets the numbers’ font.
Font FontTextCols
Gets or sets the font of texts for
the columns.
Font FontTextRows
Gets or sets the font of texts for
the rows.
double InRowCoef Gets or sets the filling coefficient (density) along
the row. Can be inside [0.2, 1].
SkyscrapersNumbersDrawing
NumbersDrawing Gets or sets the type of drawing
numbers on top of the towers. It can be
set along one of the axis or it can be defined automatically; in this case it
will be along the axis, which is closer to horizontal line.
enum SkyscrapersNumbersDrawing { Automatic, AlongX, AlongY
};
bool ParallelAxis_Left
Gets or sets the flag to show left texts parallel to
axis.
bool ParallelAxis_Right
Gets or sets the flag to show right texts parallel to axis.
TextBasicPoint RotationCenter_Left Gets
the rotation center of the left texts.
TextBasicPoint RotationCenter_Right Gets
the rotation center of the right texts.
int Rows
Gets number of rows.
string [] RowsTexts Gets or sets the texts for rows. New texts will be set only if the number of
strings in the array is equal to the number of rows.
bool ShowEdges Gets or sets the flag to show edges of the towers.
bool ShowNumbers Gets or sets the flag to show numbers on tops of the towers.
bool ShowTextsCols Gets
or sets the flag to show texts for the columns.
bool ShowTextsRows Gets
or sets the flag to show texts for the rows.
int TextsAngle_Left
Gets or sets the angle of the left texts.
int TextsAngle_Right
Gets or sets the angle of the right texts.
double [] Values
Gets or sets the array of values.
Public methods
Color ColorFace (int iRow) Gets the color of faces for the
towers in the particular row.
Color ColorSide (int iRow) Gets the color of sides for the
towers in the particular row.
Color ColorTop (int
iRow) Gets the color of tops for the towers
in the particular row.
void Draw (Graphics grfx, XYZcoordinates
xyzCoor)
Draws skyscrapers in mentioned
coordinates.
double [] GetColumnValues (int jCol) Gets the array of values for
particular column.
double [] GetRowValues (int iRow) Gets the array of values for
particular row.
double
IndividualValue (int iRow, int jCol) Gets the value for particular place.
void
ParametersDialog (Form formOwner, The form from which this dialog is
called
XYZcoordinates xyzcoor, system of coordinates
OnParamForm onChanged, the
function to be executed on change of any parameter
OnParamForm onClosed, the function to be executed on closing
the parameters’ dialog
string strTitle) title of the parameters’ dialog
This is the way to open the standard dialog for
changing the parameters of Skyscrapers.
Usually onChanged is doing nothing else but Invalidate() of the form in
which Skyscrapers is used, and two last parameters can be set to null.
void
SetColorFace (int iRow, Color clrNew) Sets the color of faces for the
towers in the particular row.
void
SetColorSide (int iRow, Color clrNew) Sets the color of sides for the
towers in the particular row.
void
SetColorTop (int iRow, Color
clrNew) Sets the color of tops for the towers
in the particular row.
bool
SetColValues (int jCol, double [] fCol) Sets the values for particular column.
void
SetRotationCenter_Left (TextBasicPoint cntr, Size sizeToCenter)
Sets the rotation center and the
shift from anchor point to the rotation center of the left texts.
void
SetRotationCenter_Right (TextBasicPoint cntr, Size sizeToCenter)
Sets the rotation center and the
shift from anchor point to the rotation center of the right texts.
bool
SetRowValues (int iRow, double [] fRow) Sets the values for particular row.
bool ValueUnderCursor (XYZcoordinates xyzCoor, system of coordinates
Point pt, mouse point
out int iRow, row
out int jCol, column
out double fValue) value under cursor
If the mouse cursor is over any of
the towers, then gets row, column and the value of this tower and returns true; otherwise returns false.
class XYZcoordinates
Class to use with any 3D
images; objects of Skyscrapers class are shown only together with this
class. Direction of axes from zero
point: axis X – left-down, axis Y – right-down, axis Z – straight up.
Public constructors
XYZcoordinates
(Point pt0, Point
ptX, Point ptY, Point
ptZ)
XYZcoordinates
(Point pt0, int
xLefter, int xAngle,
int yRighter, int yAngle, int zHigher)
XYZcoordinates must be defined by four points: the zero point of
coordinates and three end points of the axes.
These end points can be defined either by their coordinates or by shifts
from zero point and angles.
Public properties
Color AxesColor Gets or sets axes’ color.
Font Font Gets or sets the font to show texts
at the ends of axes.
Color GridsColor Gets or sets grids’ color.
LineInView LinesInView Gets or sets the combination of lines that can be
drawn. Any combination of values from LineInView enumeration can be used:
enum LineInView
{
None, nothing is shown
XAxis, X axis
YAxis, Y axis
ZAxis, Z axis
AllAxes, all three axes (XAxis | YAxis | ZAxis)
XYborder, border of XY plane
XZborder, border of XZ plane
YZborder, border of YZ plane
AllBorders,
borders of all planes (XYborder | XZborder |
YZborder)
XofXYgrid, grids from X axis on XY plane
YofXYgrid, grids from Y axis on XY plane
XofXZgrid, grids from X axis on XZ plane
ZofXZgrid, grids
from Z axis on XZ plane
YofYZgrid, grids from Y axis on YZ plane
ZofYZgrid, grids from Z axis on YZ plane
XYgrid, both grids on XY plane
XZgrid, both grids on XZ plane
YZgrid, both grids on YZ plane
AllGrids, all grids on all three planes
DefaultView
all axes and borders, but no grids
}
Color PlaneBorderColor Gets or sets color of lines bordering the planes.
Color TextsColor Gets or sets texts’ color.
double XAxisAngle Gets the angle (in degrees) of X axis; value is >=
0.
double XAxisAngle_Radian Gets the angle (in radians) of X axis; value is >= 0.
Point XEndPoint Gets point at the end of X axis.
double XEndValue Gets or sets X value at the end of X axis.
double XGridStep Gets or sets grid step along X axis.
string XText Gets or sets the text at the end of X
axis.
double XZeroValue Gets or sets X value at axes’ crossing.
double YAxisAngle Gets the angle (in degrees) of Y axis; value is >=
0.
double YAxisAngle_Radian Gets the angle (in radians) of Y axis; value is >= 0.
Point YEndPoint Gets point at the end of Y axis.
double YEndValue Gets or sets Y value at the end of Y axis.
double YGridStep Gets or sets grid step along Y axis.
string YText Gets or sets the text at the end of Y
axis.
double YZeroValue Gets or sets Y value at axes’ crossing.
Point ZEndPoint Gets point at the end of Z axis.
double ZEndValue Gets or sets Z value at the end of Z axis.
Point ZeroPoint Gets point of axes’ crossing.
double ZGridStep Gets or sets grid step along Z axis.
string ZText Gets or sets the text at the end of Z
axis.
double ZZeroValue Gets or sets Z value at axes’ crossing.
Public methods
Point []
DotBasicPoints (double fX, double fY, double fZ)
For the combination of three real
values (fX, fY, fZ) gets the array of six screen points that determine all
projects on screen, axes and planes. The
order of points is according with DotPos enumeration:
enum DotPos { OnScreen, OnX, OnY, OnZ, OnXY, OnXZ, OnYZ };
void Draw (Graphics grfx) Draws XYZcoordinates; axes, planes
and grids can be shown depending on specified drawing parameter.
void DrawColumn
(Graphics grfx, double
fx, double fy, double
fz,
double
dxCol, double dyCol,
Color
clrTop, Color clrFace, Color
clrSide,
bool
bDrawEdges, Color clrEdges,
ref
Point [] ptT, ref
Point [] ptL, ref
Point [] ptR)
Draws the column. The projection on XY plane is defined by the
values (fx, fy) and differences in values along these two axes; these are not
coordinates, but real values. Column is
shown based on XY plane, so the size along Z axis is defined by the parameter
(fz) and the value of Z axis at axes’ crossing.
Three planes of the column can be shown in three different colors. If edges of the planes must be shown, then
additional color (clrEdges) can be used for these lines. Method also returns the coordinates of
polygons around three planes.
double FromXaxis (int cx) Gets X value from cx coordinate on X
axis.
void
FromXYplane (Point pt, out
double fX, out double fY)
Gets X and Y values from the screen
point on XY plane.
void
FromXZplane (Point pt, out
double fX, out double fZ)
Gets X and Z values from the screen
point on XZ plane.
double FromYaxis (int cx) Gets Y value from cx coordinate on Y
axis.
void
FromYZplane (Point pt, out
double fY, out double fZ)
Gets Y and Z values from the screen
point on YZ plane.
double FromZaxis (int cy) Gets Z value from cy coordinate on Z
axis.
Point [] GetAreaPoints
(AreaOnScreen area)
Gets the array of points around the
area defined by the value from AreaOnScreen enumeration. The
first three values will get Point [4] array for one of the planes; the last one
will get Point [6] array that combines three planes.
enum AreaOnScreen { PlaneXY, PlaneXZ, PlaneYZ, Hexagon };
bool InsideHexagon (Point pt) Defines if the point is inside
hexagon that borders three planes.
void Move (int cx, int cy) Moves the XYZcoordinates on the defined number of pixels from
current position.
Bool MoveContourPoint (int i, int cx, int cy, Point ptM, MouseButtons catcher)
Moves one node of the contour on the
defined number of pixels from current position.
Contour of this oblects copies the axes and has four nodes: 0 – point of
axes’ crossing, 1 – end of X axis, 2 – end of Y axis, 3 – end of Z axis.
Point OnScreen (double fX, double fY,
double fZ)
For the combination of three real
values (fX, fY, fZ) gets its screen coordinate. It is one of the points returned in array by
DotBasicPoints().
Point OnXaxis (double fX, double fY,
double fZ)
For the combination of three real
values (fX, fY, fZ) gets the point of the projection on X axis. It is one of the points returned in array by
DotBasicPoints().
Point OnXYplane
(double fX, double
fY, double fZ)
For the combination of three real
values (fX, fY, fZ) gets the point of the projection on XY plane. It is one of the points returned in array by
DotBasicPoints().
Point OnXZplane
(double fX, double
fY, double fZ)
For the combination of three real
values (fX, fY, fZ) gets the point of the projection on XZ plane. It is one of the points returned in array by
DotBasicPoints().
Point OnYaxis (double fX, double fY,
double fZ)
For the combination of three real
values (fX, fY, fZ) gets the point of the projection on Y axis. It is one of the points returned in array by
DotBasicPoints().
Point OnYZplane
(double fX, double
fY, double fZ)
For the combination of three real
values (fX, fY, fZ) gets the point of the projection on YZ plane. It is one of the points returned in array by
DotBasicPoints().
Point OnZaxis (double fX, double fY,
double fZ)
For the combination of three real
values (fX, fY, fZ) gets the point of the projection on Z axis. It is one of the points returned in array by
DotBasicPoints().