OK In progress...

This commit is contained in:
Kolan Sh 2018-01-21 12:34:57 +03:00
parent d5e18999f8
commit 3d3eb05c3c
2 changed files with 205 additions and 16 deletions

View File

@ -3,38 +3,126 @@ namespace CairoChart {
/** /**
* Area rectangle. * Area rectangle.
*/ */
[Compact]
public class Area { public class Area {
double _x0 = 0;
double _x1 = 1;
double _y0 = 0;
double _y1 = 1;
double _zx0 = 0;
double _zx1 = 1;
double _zy0 = 0;
double _zy1 = 1;
/** /**
* Left bound. * Left bound.
*/ */
public double x0 = 0; public double x0 {
get {
return _x0;
}
set {
_zx0 = _x0 = value;
}
}
/** /**
* Top bound. * Top bound.
*/ */
public double y0 = 0; public double y0 {
get {
return _y0;
}
set {
_zy0 = _y0 = value;
}
}
/** /**
* Right bound. * Right bound.
*/ */
public double x1 = 1; public double x1 {
get {
return _x1;
}
set {
_zx1 = _x1 = value;
}
}
/** /**
* Bottom bound. * Bottom bound.
*/ */
public double y1 = 1; public double y1 {
get {
return _y1;
}
set {
_zy1 = _y1 = value;
}
}
/**
* Zoomed Left bound.
*/
public double zx0 {
get {
return _zx0;
}
set {
if (_x0 <= value <= _x1)
_zx0 = value;
}
}
/**
* Zoomed Top bound.
*/
public double zy0 {
get {
return _zy0;
}
set {
if (_y0 <= value <= _y1)
_zy0 = value;
}
}
/**
* Zoomed Right bound.
*/
public double zx1 {
get {
return _zx1;
}
set {
if (_x0 <= value <= _x1)
_zx1 = value;
}
}
/**
* Zoomed Bottom bound.
*/
public double zy1 {
get {
return _zy1;
}
set {
if (_y0 <= value <= _y1)
_zy1 = value;
}
}
/** /**
* ``Area`` width. * ``Area`` width.
*/ */
public double width { public double width {
get { get {
return x1 - x0; return _x1 - _x0;
} }
set { set {
x1 = x0 + value; _zx1 = _x1 = _x0 + value;
} }
} }
@ -43,10 +131,36 @@ namespace CairoChart {
*/ */
public double height { public double height {
get { get {
return y1 - y0; return _y1 - _y0;
} }
set { set {
y1 = y0 + value; _zy1 = _y1 = _y0 + value;
}
}
/**
* ``Area`` zoomed width.
*/
public double zwidth {
get {
return _zx1 - _zx0;
}
set {
if (_zx0 <= _zx0 + value <= _x1)
_zx1 = _zx0 + value;
}
}
/**
* ``Area`` zoomed height.
*/
public double zheight {
get {
return _zy1 - _zy0;
}
set {
if (_zy0 <= _zy0 + value <= _y1)
_zy1 = _zy0 + value;
} }
} }
@ -111,5 +225,15 @@ namespace CairoChart {
public Area copy () { public Area copy () {
return new Area.with_area(this); return new Area.with_area(this);
} }
/**
* Unzooms ``Area``.
*/
public void unzoom () {
_zx0 = x0;
_zy0 = y0;
_zx1 = x1;
_zy1 = y1;
}
} }
} }

View File

@ -3,28 +3,85 @@ namespace CairoChart {
/** /**
* Linear range. * Linear range.
*/ */
[Compact]
public class Range { public class Range {
double _low = 0;
double _high = 1;
double _zlow = 0;
double _zhigh = 1;
/** /**
* Low bound. * Low bound.
*/ */
public double low = 0; public double low {
get {
return _low;
}
set {
_zlow = _low = value;
}
}
/** /**
* High bound. * High bound.
*/ */
public double high = 1; public double high {
get {
return _high;
}
set {
_zhigh = _high = value;
}
}
/**
* Zoomed low bound.
*/
double zlow {
get {
return _zlow;
}
set {
if (_low <= value <= _high)
_zlow = value;
}
}
/**
* Zoomed high bound.
*/
double zhigh {
get {
return _zhigh;
}
set {
if (_low <= value <= _high)
_zhigh = value;
}
}
/** /**
* ``Range`` value. * ``Range`` value.
*/ */
public double range { public double range {
get { get {
return high - low; return _high - _low;
} }
set { set {
high = low + value; _zhigh = _high = _low + value;
}
}
/**
* ``Range`` zoomed value.
*/
public double zrange {
get {
return _zhigh - _zlow;
}
set {
if (_zlow <= _zlow + value <= _high)
_zhigh = _zlow + value;
} }
} }
@ -60,8 +117,16 @@ namespace CairoChart {
/** /**
* Gets a copy of the ``Range``. * Gets a copy of the ``Range``.
*/ */
public Range copy () { public Range copy () {
return new Range.with_range(this); return new Range.with_range(this);
} }
/**
* Unzooms ``Range``.
*/
public void unzoom () {
_zlow = low;
_zhigh = high;
}
} }
} }