Пример #1
0
bool Check_CC_point(const CC_point& underTest, const CC_point_values& values)
{
	bool running_value = true;
	for (unsigned i = 0; i < CC_point::kNumRefPoints; ++i)
		running_value = running_value && (underTest.mRef[i] == values.mRef[i]);
	return running_value
		&& (underTest.mFlags == values.mFlags)
		&& (underTest.mSym == values.mSym)
		&& (underTest.mPos == values.mPos)
		&& (underTest.GetFlip() == values.GetFlip)
		;
}
Пример #2
0
void CC_point_UnitTests()
{
	// test some defaults:
	CC_point_values values;
	values.mFlags = 0;
	values.mSym = SYMBOL_PLAIN;
	values.mPos = CC_coord();
	for (unsigned i = 0; i < CC_point::kNumRefPoints; ++i)
		values.mRef[i] = CC_coord();
	values.GetFlip = false;

	// test defaults
	CC_point underTest;
	assert(Check_CC_point(underTest, values));

	// test flip
	underTest.Flip(false);
	assert(Check_CC_point(underTest, values));

	values.mFlags = 1;
	values.GetFlip = true;
	underTest.Flip(true);
	assert(Check_CC_point(underTest, values));

	values.mFlags = 0;
	values.GetFlip = false;
	underTest.Flip(false);
	assert(Check_CC_point(underTest, values));

	// test flip toggle
	values.mFlags = 1;
	values.GetFlip = true;
	underTest.FlipToggle();
	assert(Check_CC_point(underTest, values));

	values.mFlags = 0;
	values.GetFlip = false;
	underTest.FlipToggle();
	assert(Check_CC_point(underTest, values));

}
Пример #3
0
void
DrawPoint(wxDC& dc, const CalChartConfiguration& config, const CC_point& point, unsigned reference, const CC_coord& origin, const wxString& label)
{
    DrawPointHelper(dc, config, point.GetPos(reference) + origin, point, label);
}
Пример #4
0
void
DrawPointHelper(wxDC& dc, const CalChartConfiguration& config, const CC_coord& pos, const CC_point& point, const wxString& label)
{
    SaveAndRestore_Brush restore(dc);
    const float circ_r = Float2Coord(config.Get_DotRatio());
    const float offset = circ_r / 2;
    const float plineoff = offset * config.Get_PLineRatio();
    const float slineoff = offset * config.Get_SLineRatio();
    float textoff = offset * 1.25;

    long x = pos.x;
    long y = pos.y;
    switch (point.GetSymbol())
    {
    case SYMBOL_SOL:
    case SYMBOL_SOLBKSL:
    case SYMBOL_SOLSL:
    case SYMBOL_SOLX:
        break;
    default:
        dc.SetBrush(*wxTRANSPARENT_BRUSH);
    }
    dc.DrawEllipse(x - offset, y - offset, circ_r, circ_r);
    switch (point.GetSymbol())
    {
    case SYMBOL_SL:
    case SYMBOL_X:
        dc.DrawLine(x - plineoff, y + plineoff,
                    x + plineoff, y - plineoff);
        break;
    case SYMBOL_SOLSL:
    case SYMBOL_SOLX:
        dc.DrawLine(x - slineoff, y + slineoff,
                    x + slineoff, y - slineoff);
        break;
    default:
        break;
    }
    switch (point.GetSymbol())
    {
    case SYMBOL_BKSL:
    case SYMBOL_X:
        dc.DrawLine(x - plineoff, y - plineoff,
                    x + plineoff, y + plineoff);
        break;
    case SYMBOL_SOLBKSL:
    case SYMBOL_SOLX:
        dc.DrawLine(x - slineoff, y - slineoff,
                    x + slineoff, y + slineoff);
        break;
    default:
        break;
    }
    if (point.LabelIsVisible()) {
        wxCoord textw, texth, textd;
        dc.GetTextExtent(label, &textw, &texth, &textd);
        dc.DrawText(label,
                    point.GetFlip() ? x : (x - textw),
                    y - textoff - texth + textd);
    }
}