コード例 #1
0
ファイル: canlua.cpp プロジェクト: Abyss116/luaplus51-all
void wxlCanObj::Draw( wxDC& dc, double absx, double absy )
{
    if ( m_brush.Ok() )
        dc.SetBrush( m_brush );
    if ( m_pen.Ok() )
        dc.SetPen( m_pen );

    wxBrush currentBrush = dc.GetBrush();
    wxPen currentPen = dc.GetPen();

    absx += m_x;
    absy += m_y;

    DoDraw( dc, absx, absy );

    // iterate over the child list
    for ( wxlCanObjList::Node *node = m_objects.GetFirst(); node; node = node->GetNext() )
    {
        wxlCanObj *drawobj = node->GetData();
        // restore brush and pen
        dc.SetBrush( currentBrush );
        dc.SetPen( currentPen );
        drawobj->Draw( dc , absx, absy );
    }
}
コード例 #2
0
bool RedHatchDrawlet::Draw(wxDC &dc)
{
#if wxCHECK_VERSION(2, 9, 0)
    wxRasterOperationMode old_lf = dc.GetLogicalFunction();
#else
    int old_lf = dc.GetLogicalFunction();
#endif
    dc.SetLogicalFunction(wxXOR);

    wxPen old_pen = dc.GetPen();
    wxBrush old_brush = dc.GetBrush();

    wxColor red = wxColor( ~wxRED->Red(), ~wxRED->Green(), ~wxRED->Blue());
#if wxCHECK_VERSION(2,9,0)
    wxBrush brush = wxBrush(red, wxHATCHSTYLE_CROSSDIAG );
#else
    wxBrush brush = wxBrush(red, wxCROSSDIAG_HATCH );
#endif

    dc.SetPen(*wxTRANSPARENT_PEN);
    dc.SetBrush(brush);

    dc.DrawRectangle(m_rect);

    dc.SetLogicalFunction(old_lf);
    dc.SetPen(old_pen);
    dc.SetBrush(old_brush);

    return true;
}
コード例 #3
0
void SeqABI::drawTopLine ( wxDC &dc , int y )
    {
    wxPen p = dc.GetPen () ;
    dc.SetPen(*wxLIGHT_GREY_PEN);
    dc.DrawLine ( 4 , y , minx + maxx , y ) ;
    dc.SetPen(p);
    }
コード例 #4
0
ファイル: dcmemory.cpp プロジェクト: ahlekoofe/gamekit
// For some reason, drawing a rectangle on a memory DC has problems.
// Use this substitute if we can.
static void wxDrawRectangle(wxDC& dc, wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
    wxBrush brush(dc.GetBrush());
    wxPen pen(dc.GetPen());
    if (brush.Ok() && brush.GetStyle() != wxTRANSPARENT)
    {
        HBRUSH hBrush = (HBRUSH) brush.GetResourceHandle() ;
        if (hBrush)
        {
            RECT rect;
            rect.left = x;
            rect.top = y;
            rect.right = x + width - 1;
            rect.bottom = y + height - 1;
            ::FillRect((HDC) dc.GetHDC(), &rect, hBrush);
        }
    }
    width --;
    height --;
    if (pen.Ok() && pen.GetStyle() != wxTRANSPARENT)
    {
        dc.DrawLine(x, y, x + width, y);
        dc.DrawLine(x, y, x, y + height);
        dc.DrawLine(x, y+height, x+width, y + height);
        dc.DrawLine(x+width, y+height, x+width, y);
    }
}
コード例 #5
0
void UIElementVectorial::DrawStaticBox(wxDC& dc,const wxString& label, const wxPoint& pos, const wxSize& size)
{
	wxColour c_pen = dc.GetPen().GetColour();
	dc.SetPen(wxPen(dc.GetTextForeground()));
	dc.DrawRoundedRectangle(pos.x, pos.y, size.x, size.y,3.1f);
	dc.SetPen(wxPen(c_pen));
	dc.DrawRotatedText(label,pos.x+10,pos.y,0);
}
コード例 #6
0
ファイル: aqua.cpp プロジェクト: sqba/floopy
void DrawAquaRect(wxDC& dc, wxRect& rc, int radius)
{
	int left	= rc.GetX();
	int top		= rc.GetTop();
	int height	= rc.GetHeight();
	int width	= rc.GetWidth();
	int right	= left+width;

	if(width <= radius*2)
		return;

	wxPen oldpen = dc.GetPen();

	int border	= 2;//(IsSelected() ? 2 : 1);

	int edge = radius;
	int endEdge = top+radius;
	float rstep = 60.f / ((float)height / 3.f);
	float gstep = 20.f / ((float)height / 3.f);
	float r=180.f, g=190.f, b=225.f;
	for(int y=top+1; y<top+height/3; y++)
	{
		r -= rstep;
		g -= gstep;
		dc.SetPen( wxPen(wxColor(r, g, b), border) );
		if(y<endEdge)
		{
			dc.DrawLine(left+edge, y, right-edge*2, y);
			edge--;
		}
		else
			dc.DrawLine(left, y, right, y);
	}

	edge = 1;
	int startEdge = top+height-radius;
	rstep = 75.f / (((float)height / 3.f) * 2.f);
	gstep = 51.f / (((float)height / 3.f) * 2.f);
	r=111.f, g=161.f, b=225.f;
	for(int y=top+height/3; y<top+height-1; y++)
	{
		r += rstep;
		g += gstep;
		dc.SetPen( wxPen(wxColor(r, g, b), border) );
		if(y>=startEdge)
		{
			dc.DrawLine(left+edge, y, right-edge*2, y);
			edge++;
		}
		else
			dc.DrawLine(left, y, right, y);
	}

	dc.SetPen( oldpen );
}
コード例 #7
0
ファイル: plot.cpp プロジェクト: darckense/fityk
void draw_line_with_style(wxDC& dc, wxPenStyle style,
                          wxCoord X1, wxCoord Y1, wxCoord X2, wxCoord Y2)
{
    wxPen pen = dc.GetPen();
    wxPenStyle old_style = pen.GetStyle();
    pen.SetStyle(style);
    dc.SetPen(pen);
    dc.DrawLine (X1, Y1, X2, Y2);
    pen.SetStyle(old_style);
    dc.SetPen(pen);
}
コード例 #8
0
ファイル: pathctrl.cpp プロジェクト: sqba/floopy
void CPathItem::DrawBG(wxDC &dc, wxRect &rc)
{
	wxPen oldpen = dc.GetPen();
	wxPen pen( IsSelected() ? *wxBLACK_PEN : *wxMEDIUM_GREY_PEN );
	pen.SetWidth(IsSelected() ? 2 : 1);
	dc.SetPen( pen );

	wxBrush oldBrush = dc.GetBrush();
	wxBrush brush(m_color, NULL!=m_pInput ? wxSOLID : wxTRANSPARENT);
	dc.SetBrush(brush);

	int x = rc.GetX();
	int y = rc.GetY();
	int w = rc.GetWidth();
	int h = rc.GetHeight();
	int n = 0;

	wxPoint points[6];

	if(NULL != m_pInput)
	{
		points[0] = wxPoint(x,								y);
		points[1] = wxPoint(x+w-GAP_LENGTH,					y);
		points[2] = wxPoint(x+w+CORNER_LENGTH-GAP_LENGTH,	y+h/2);
		points[3] = wxPoint(x+w-GAP_LENGTH,					y+h);
		points[4] = wxPoint(x,								y+h);
		points[5] = wxPoint(x+CORNER_LENGTH,				y+h/2);

		n = m_bFirst ? 5 : 6;
	}
	else
	{
		// Last component: mixer
		points[0] = wxPoint(x,					y);
		points[1] = wxPoint(x+w,				y);
		points[2] = wxPoint(x+w,				y+h);
		points[3] = wxPoint(x,					y+h);
		points[4] = wxPoint(x+CORNER_LENGTH,	y+h/2);

		n = 5;
	}

	if(m_pRegion)
		delete m_pRegion;
	m_pRegion = new wxRegion(n, points);

	dc.DrawPolygon(n, points);

	dc.SetBrush( oldBrush );
	dc.SetPen(oldpen);
}
コード例 #9
0
ファイル: plot.cpp プロジェクト: darckense/fityk
/// draw x axis tics
void FPlot::draw_xtics (wxDC& dc, Rect const &v, bool set_pen)
{
    if (set_pen) {
        dc.SetPen(wxPen(xAxisCol, pen_width));
        dc.SetTextForeground(xAxisCol);
    }
    set_font(dc, ticsFont);
    // get tics text height
    wxCoord h;
    dc.GetTextExtent(wxT("1234567890"), 0, &h);

    vector<double> minors;
    vector<double> x_tics = scale_tics_step(v.left(), v.right(), x_max_tics,
                                            minors, xs.logarithm);

    //if x axis is visible tics are drawed at the axis,
    //otherwise tics are drawed at the bottom edge of the plot
    const int pixel_height = get_pixel_height(dc);
    int Y = pixel_height - h;
    if (x_axis_visible && !ys.logarithm && ys.px(0) >= 0 && ys.px(0) < Y)
        Y = ys.px(0);
    for (vector<double>::const_iterator i = x_tics.begin();
                                                    i != x_tics.end(); ++i) {
        int X = xs.px(*i);
        dc.DrawLine (X, Y, X, Y - x_tic_size);
        wxString label = format_label(*i, v.right() - v.left());
        wxCoord w;
        dc.GetTextExtent (label, &w, 0);
        dc.DrawText (label, X - w/2, Y + 1);
        if (x_grid) {
            wxPen pen = dc.GetPen();
            pen.SetStyle(wxPENSTYLE_DOT);
            wxDCPenChanger pen_changer(dc, pen);
            dc.DrawLine(X, 0, X, Y);
            dc.DrawLine(X, Y+1+h, X, pixel_height);
            /*
            draw_line_with_style(dc, wxPENSTYLE_DOT, X, 0, X, Y);
            draw_line_with_style(dc, wxPENSTYLE_DOT, X, Y+1+h, X, pixel_height);
            */
        }
    }
    //draw minor tics
    if (xminor_tics_visible)
        for (vector<double>::const_iterator i = minors.begin();
                                                    i != minors.end(); ++i) {
            int X = xs.px(*i);
            dc.DrawLine (X, Y, X, Y - x_tic_size);
        }
}
コード例 #10
0
// draws a line of symbols
void wxSymbolListCtrl::OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const
{
    wxColour oldTextColour = dc.GetTextForeground();
    int startSymbol = n*m_symbolsPerLine;

    int i;
    for (i = 0; i < m_symbolsPerLine; i++)
    {
        bool resetColour = false;
        int symbol = startSymbol+i;
        if (symbol == m_current)
        {
            dc.SetBrush(wxBrush(m_colBgSel));

            dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT));
            resetColour = true;

            wxPen oldPen = dc.GetPen();
            dc.SetPen(*wxTRANSPARENT_PEN);

            dc.DrawRectangle(rect.x + i*m_cellSize.x, rect.y, m_cellSize.x, rect.y+rect.height);
            dc.SetPen(oldPen);
        }

        // Don't draw first line
        if (i != 0)
            dc.DrawLine(rect.x + i*m_cellSize.x, rect.y, i*m_cellSize.x, rect.y+rect.height);

        if (symbol >= m_minSymbolValue && symbol <= m_maxSymbolValue)
        {
            wxString text;
            text << (wxChar) symbol;

            wxCoord w, h;
            dc.GetTextExtent(text, & w, & h);

            int x = rect.x + i*m_cellSize.x + (m_cellSize.x - w)/2;
            int y = rect.y + (m_cellSize.y - h)/2;
            dc.DrawText(text, x, y);
        }

        if (resetColour)
            dc.SetTextForeground(oldTextColour);
    }

    // Draw horizontal separator line
    dc.DrawLine(rect.x, rect.y+rect.height-1, rect.x+rect.width, rect.y+rect.height-1);
}
コード例 #11
0
ファイル: floopycontrol.cpp プロジェクト: sqba/floopy
void CFloopyControl::DrawBG(wxDC& dc, wxRect& rc)
{
	wxBrush oldBrush = dc.GetBrush();
	wxPen oldpen = dc.GetPen();

	wxPen pen( *wxLIGHT_GREY );
	pen.SetWidth(1);
	dc.SetPen( pen );

	wxBrush brush(GetParent()->GetColor(), wxSOLID);
	dc.SetBrush(brush);

	dc.DrawRoundedRectangle(rc.GetX(), rc.GetTop(),
		rc.GetWidth(), rc.GetHeight(), 2);

	dc.SetPen(oldpen);
	dc.SetBrush( oldBrush );
}
コード例 #12
0
ファイル: wksp_layer_legend.cpp プロジェクト: am2222/SAGA-GIS
//---------------------------------------------------------
inline void CWKSP_Layer_Legend::_Draw_Box(wxDC &dc, int y, int dy, wxColour Color)
{
	wxPen	Pen;
	wxBrush	Brush;

	//-----------------------------------------------------
	_Set_Size(0, dy);

	dy	-= BOX_SPACE;

	//-----------------------------------------------------
	if( m_Box_bOutline == false )
	{
		Pen		= dc.GetPen();
		Pen.SetColour(Color);
		dc.SetPen(Pen);
	}

	if( m_Box_bFill )
	{
		Brush	= dc.GetBrush();
		Brush.SetColour(Color);
		dc.SetBrush(Brush);
	}

	//-----------------------------------------------------
	switch( m_BoxStyle )
	{
	case BOXSTYLE_LINE:
		dc.DrawLine(m_xBox                  , y + dy / 2, m_xBox +     m_dxBox / 4, y);
		dc.DrawLine(m_xBox +     m_dxBox / 4, y         , m_xBox + 3 * m_dxBox / 4, y + dy);
		dc.DrawLine(m_xBox + 3 * m_dxBox / 4, y + dy    , m_xBox +     m_dxBox    , y + dy / 2);
		break;

	case BOXSTYLE_CIRCLE:
		dc.DrawCircle(m_xBox + m_dxBox / 2, y + dy / 2, dy / 2);
		break;

	case BOXSTYLE_RECT:	default:
		dc.DrawRectangle(m_xBox, y, m_dxBox, dy);
		break;
	}
}
コード例 #13
0
ファイル: StateEvaluationTree.cpp プロジェクト: mheinsen/seec
void StateEvaluationTreePanel::drawIndicatorAtArea(wxDC &DC,
                                                   IndicatorStyle const &Style,
                                                   wxCoord X, wxCoord Y,
                                                   wxCoord W, wxCoord H)
{
  auto const Kind = Style.GetKind();
  auto const FG   = Style.GetForeground();
  
  wxPen const PrevPen = DC.GetPen();
  wxBrush const PrevBrush = DC.GetBrush();
  
  switch (Kind) {
    case IndicatorStyle::EKind::Plain:
      DC.SetPen(wxPen{FG, Settings.PenWidth});
      DC.DrawLine(X, Y+H, X+W, Y+H);
      break;
    case IndicatorStyle::EKind::Box:
      DC.SetPen(wxPen{FG, Settings.PenWidth});
      DC.DrawRectangle(X, Y, W, H);
      break;
    case IndicatorStyle::EKind::StraightBox:
      // Many DCs don't support alpha at all, so manually calculate an alpha
      // against the background colour.
      auto const BG = PrevBrush.GetColour();
      double const Alpha        = (double)Style.GetAlpha() / 255;
      double const OutlineAlpha = (double)Style.GetOutlineAlpha() / 255;
      DC.SetPen(wxPen{
        wxColour(wxColour::AlphaBlend(FG.Red(), BG.Red(), OutlineAlpha),
                 wxColour::AlphaBlend(FG.Green(), BG.Green(), OutlineAlpha),
                 wxColour::AlphaBlend(FG.Blue(), BG.Blue(), OutlineAlpha)),
        Settings.PenWidth});
      DC.SetBrush(wxBrush{
        wxColour(wxColour::AlphaBlend(FG.Red(), BG.Red(), Alpha),
                 wxColour::AlphaBlend(FG.Green(), BG.Green(), Alpha),
                 wxColour::AlphaBlend(FG.Blue(), BG.Blue(), Alpha))});
      DC.DrawRectangle(X, Y, W, H);
      break;
  }
  
  DC.SetPen(PrevPen);
  DC.SetBrush(PrevBrush);
}
コード例 #14
0
ファイル: drawingutils.cpp プロジェクト: Hmaal/codelite
void DrawingUtils::PaintStraightGradientBox(wxDC& dc,
        const wxRect& rect,
        const wxColour& startColor,
        const wxColour& endColor,
        bool  vertical)
{
    int rd, gd, bd, high = 0;
    rd = endColor.Red() - startColor.Red();
    gd = endColor.Green() - startColor.Green();
    bd = endColor.Blue() - startColor.Blue();

    /// Save the current pen and brush
    wxPen savedPen = dc.GetPen();
    wxBrush savedBrush = dc.GetBrush();

    if ( vertical )
        high = rect.GetHeight()-1;
    else
        high = rect.GetWidth()-1;

    if ( high < 1 )
        return;

    for (int i = 0; i <= high; ++i) {
        int r = startColor.Red() +  ((i*rd*100)/high)/100;
        int g = startColor.Green() + ((i*gd*100)/high)/100;
        int b = startColor.Blue() + ((i*bd*100)/high)/100;

        wxPen p(wxColor(r, g, b));
        dc.SetPen(p);

        if ( vertical )
            dc.DrawLine(rect.x, rect.y+i, rect.x+rect.width, rect.y+i);
        else
            dc.DrawLine(rect.x+i, rect.y, rect.x+i, rect.y+rect.height);
    }

    /// Restore the pen and brush
    dc.SetPen( savedPen );
    dc.SetBrush( savedBrush );
}
コード例 #15
0
//---------------------------------------------------------
void CVIEW_ScatterPlot::_Draw_Regression(wxDC &dc, wxRect r)
{
	wxPen	oldPen	= dc.GetPen();

	dc.SetPen(wxPen(
		m_Options("REG_COLOR")->asColor(),
		m_Options("REG_SIZE" )->asInt()
	));

	//-----------------------------------------------------
	double	dx	= (r.GetWidth () - 1.) / m_Trend.Get_Data_XStats().Get_Range();
	double	dy	= (r.GetHeight() - 1.) / m_Trend.Get_Data_YStats().Get_Range();

	//-----------------------------------------------------
	dc.DrawCircle(
		GET_DC_X(m_Trend.Get_Data_XStats().Get_Mean()),
		GET_DC_Y(m_Trend.Get_Data_YStats().Get_Mean()), 2
	);

	double	ex	= m_Trend.Get_Data_XStats().Get_Range() / (double)r.GetWidth();
	double	x	= m_Trend.Get_Data_XMin();

	for(int ix=0, ay, by=0; ix<r.GetWidth(); ix++, x+=ex)
	{
		double	y	= m_Trend.Get_Value(x);

		ay	= by; by = r.GetBottom() - (int)(dy * (y - m_Trend.Get_Data_YMin()));

		if( ix > 0 && r.GetTop() < ay && ay < r.GetBottom() && r.GetTop() < by && by < r.GetBottom() )
		{
			dc.DrawLine(r.GetLeft() + ix - 1, ay, r.GetLeft() + ix, by);
		}
	}

	dc.SetPen(oldPen);

	//-----------------------------------------------------
	Draw_Text(dc, TEXTALIGN_BOTTOMCENTER, r.GetLeft() + r.GetWidth() / 2, r.GetTop(),
		m_Trend.Get_Formula(SG_TREND_STRING_Compact).c_str()
	);
}
コード例 #16
0
void ColourGridCellRenderer::Draw(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, const wxRect& rect, int row, int col, bool isSelected)
{
  //Call base class to clear the full drawing area and render the string
  OffsetStringGridCellRenderer::Draw(grid, attr, dc, rect, row, col, isSelected);

  //Get the old state
  wxBrush oldBrush = dc.GetBrush();
  wxPen   oldPen   = dc.GetPen();

  //Set the new state
  dc.SetBrush(wxBrush(renderColour));
  dc.SetPen(wxPen(*wxBLACK));

  //Render the color box
  wxRect renderRect = wxRect(rect.x + 5,rect.y + 1, 17, 14).Intersect(rect);
  dc.DrawRectangle(renderRect);

  //Restore the old state
  dc.SetBrush(oldBrush);
  dc.SetPen(oldPen);
}
コード例 #17
0
ファイル: autoaxis.cpp プロジェクト: betrixed/AGW
void LineFit::renderDC(wxDC& dc, PixelWorld& px)
{
	Series& xdata = *(xdata_);
	Series& ydata = *(ydata_);
	auto savepen = dc.GetPen();
	wxPen colpen(lineColor_);
	colpen.SetWidth(lineWidth_);

	dc.SetPen(colpen);

	double xscale, yscale, xoffset, yoffset;

	px.getXScale(xscale, xoffset);
	px.getYScale(yscale, yoffset);

	for (size_t i = 1; i < xdata.size(); i++)
	{
		auto x0 = xdata[i - 1];
		auto y0 = ydata[i - 1];
		auto x = xdata[i];
		auto y = ydata[i];

		auto xpt0  = (int)((x0 - xoffset)* xscale) + px.left_;
		auto ypt0 = (int)((y0 - yoffset)* yscale) + px.top_;
		auto xpt = (int)((x - xoffset)* xscale) + px.left_;
		auto ypt = (int)((y - yoffset)* yscale) + px.top_;

		dc.DrawLine(xpt0, ypt0, xpt, ypt);


	}
	// put some text label showing the rate of warming halfway along line


	dc.SetPen(savepen);
}
コード例 #18
0
ファイル: StateEvaluationTree.cpp プロジェクト: mheinsen/seec
void StateEvaluationTreePanel::drawNode(wxDC &DC,
                                        ColourScheme const &Scheme,
                                        NodeInfo const &Node,
                                        NodeDecoration const Decoration)
{
  auto const CharWidth  = DC.GetCharWidth();
  auto const CharHeight = DC.GetCharHeight();
  
  wxCoord const PageBorderV = CharHeight * Settings.PageBorderVertical;
  
  // Determine the indicator (if any).
  IndicatorStyle const *Indicator = nullptr;
  switch (Decoration) {
    case NodeDecoration::None:
      break;
    case NodeDecoration::Active:
      Indicator = &(Scheme.getActiveCode());
      break;
    case NodeDecoration::Highlighted:
      Indicator = &(Scheme.getHighlightCode());
      break;
  }
  
  // Set the background colour.
  DC.SetPen(wxPen{Scheme.getDefault().GetForeground(), Settings.PenWidth});
  DC.SetBrush(wxBrush{Scheme.getDefault().GetBackground()});
  DC.SetTextForeground(Scheme.getDefault().GetForeground());
  
  // Also highlight this node's area in the pretty-printed Stmt.
  if (Indicator) {
    drawIndicatorAtArea(DC, *Indicator,
                        Node.XStart, PageBorderV,
                        Node.XEnd - Node.XStart, CharHeight);
  }
  
  // Draw the background.
  wxPen const PrevPen = DC.GetPen();
  DC.SetPen(wxPen{DC.GetBrush().GetColour()});
  DC.DrawRectangle(Node.XStart, Node.YStart,
                   Node.XEnd - Node.XStart, Node.YEnd - Node.YStart);
  DC.SetPen(PrevPen);

  // Draw the line over the node.
  DC.DrawLine(Node.XStart, Node.YStart, Node.XEnd + 1, Node.YStart);
  
  // Draw the base indicator on the node (if any).
  if (Indicator) {
    drawIndicatorAtArea(DC, *Indicator,
                        Node.XStart, Node.YStart,
                        Node.XEnd - Node.XStart, Node.YEnd - Node.YStart);
  }
  
  // Draw the error indicator if the node has an error.
  if (Node.Error == NodeError::Error) {
    drawIndicatorAtArea(DC, Scheme.getErrorCode(),
                        Node.XStart, Node.YStart,
                        Node.XEnd - Node.XStart, Node.YEnd - Node.YStart);
  }

  // Draw the node's value string.
  if (Node.Value) {
    auto const ValText = Node.ValueStringShort;
    auto const TextWidth = CharWidth * ValText.size();
    auto const NodeWidth = CharWidth * Node.RangeLength;
    auto const Offset = (NodeWidth - TextWidth) / 2;
    DC.DrawText(ValText, Node.XStart + Offset, Node.YStart);
  }
}
コード例 #19
0
ファイル: wksp_layer_legend.cpp プロジェクト: am2222/SAGA-GIS
//---------------------------------------------------------
void CWKSP_Layer_Legend::_Draw_Point(wxDC &dc, CWKSP_Shapes_Point *pLayer)
{
	bool		bSize;
	int			min_Size, max_Size;
	double		min_Value, d_Value;
	wxString	Name, Name_Size;
	wxPen		Pen;
	wxBrush		Brush;

	//-----------------------------------------------------
	m_BoxStyle		= BOXSTYLE_CIRCLE;
	m_Box_bFill		= true;

	//-----------------------------------------------------
	bSize	= pLayer->Get_Style_Size(min_Size, max_Size, min_Value, d_Value, &Name_Size);

	pLayer->Get_Style(Pen, Brush, m_Box_bOutline, &Name);

	if( m_pClassify->Get_Mode() != CLASSIFY_UNIQUE || !bSize )
	{
		dc.SetBrush(Brush);
		dc.SetPen(Pen);

		if( Name.Length() > 0 )
		{
			_Draw_Title(dc, FONT_SUBTITLE, Name);
		}

	//	_Draw_Boxes(dc, m_Position.y);
		for(int i=m_pClassify->Get_Class_Count()-1, y=m_Position.y; i>=0; i--, y+=BOX_HEIGHT)
		{
	//		_Draw_Box	(dc, y, BOX_HEIGHT, Get_Color_asWX(m_pClassify->Get_Class_Color(i)));
			_Set_Size(0, BOX_HEIGHT);

			if( m_Box_bOutline == false )
			{
				Pen		= dc.GetPen();
				Pen.SetColour(Get_Color_asWX(m_pClassify->Get_Class_Color(i)));
				dc.SetPen(Pen);
			}

			if( m_Box_bFill )
			{
				Brush	= dc.GetBrush();
				Brush.SetColour(Get_Color_asWX(m_pClassify->Get_Class_Color(i)));
				dc.SetBrush(Brush);
			}

			pLayer->Draw_Symbol(dc, m_xBox + m_dxBox / 2, y + (BOX_HEIGHT - BOX_SPACE) / 2, (BOX_HEIGHT - BOX_SPACE) / 2);

			_Draw_Label(dc, y, m_pClassify->Get_Class_Name(i), TEXTALIGN_TOP);
		}
	}

	//-----------------------------------------------------
	if( bSize )
	{
		dc.SetBrush(Brush);
		dc.SetPen(Pen);

		_Draw_Title(dc, FONT_SUBTITLE, Name_Size);
		_Draw_Point_Sizes(dc, pLayer, min_Size, max_Size, min_Value, d_Value);
		_Set_Size(0, SIZE_HEIGHT + dc.GetFont().GetPointSize());
	}
}
コード例 #20
0
ファイル: autoaxis.cpp プロジェクト: betrixed/AGW
void DataLayer::renderDC(wxDC& dc, PixelWorld& px)
{
    Series& xdata = *(xdata_);
    Series& ydata = *(ydata_);
    auto savepen = dc.GetPen();


    wxPen colpen(symbolBorder_);

    dc.SetPen(colpen);


    auto savefill = dc.GetBrush();
    wxBrush fill(symbolFill_);
    dc.SetBrush(fill);
    const double& xscale = px.xScale_.scale_;
    const double& yscale = px.yScale_.scale_;
    const double& xoffset = px.xScale_.offset_;
    const double& yoffset = px.yScale_.offset_;

    const int radius = (this->symbolSize_)*2 + 1;

    // draw lines first
    wxPenStyle linepen = indexToPenStyle(lineStyle_);

    wxRect clip(px.left_,px.top_, px.xspan_, px.yspan_);

    {


        if ((lineWidth_ > 0) && (linepen != wxPENSTYLE_TRANSPARENT))
        {
            wxPen linePen(lineColor_, lineWidth_, linepen);

            auto savePen = dc.GetPen();
            dc.SetPen(linePen);
            dc.SetClippingRegion(clip);

            int xprev = 0;
            int yprev = 0;
            for(size_t i = 0; i < xdata.size(); i++)
            {
                auto x = xdata[i];
                auto y = ydata[i];
                if (std::isnan(x) || std::isnan(y))
                    continue;
                auto xpt = (int)( (x-xoffset)* xscale ) + px.left_;
                auto ypt = (int)( (y-yoffset)* yscale ) + px.top_;

                if (i > 0)
                {
                    dc.DrawLine(xprev,yprev,xpt,ypt);
                }
                xprev = xpt;
                yprev = ypt;
            }

            dc.SetPen(savePen);
        }

        auto sdraw = SymbolDraw::MakeSymbolDraw((PlotShape)symbolShape_, radius, dc);
        wxPen sympen(this->symbolBorder_, 1, wxPENSTYLE_SOLID);

        dc.SetPen(sympen);
        dc.SetClippingRegion(clip);
        auto errors = errorbar_;
        for(size_t i = 0; i < xdata.size(); i++)
        {
            auto x = xdata[i];
            auto y = ydata[i];
            if (std::isnan(x) || std::isnan(y))
                continue;
            auto xpt = (int)( (x-xoffset)* xscale ) + px.left_;
            auto ypt = (int)( (y-yoffset)* yscale ) + px.top_;

            sdraw->draw(xpt,ypt);

            if (errors != nullptr)
            {
                auto errorSize = (*errors)[i];
                auto ept = (int)( errorSize*yscale);
                dc.DrawLine(xpt,ypt-ept,xpt,ypt+ept);
                dc.DrawLine(xpt-radius,ypt-ept,xpt+radius, ypt-ept);
                dc.DrawLine(xpt-radius,ypt+ept,xpt+radius, ypt+ept);
            }
        }
    }
    dc.SetBrush(savefill);
    dc.SetPen(savepen);
    dc.DestroyClippingRegion();
}
コード例 #21
0
void wxJigsawShape::DrawShapeHeader(wxDC & dc, const wxPoint & pos, 
		const wxSize & size, const wxJigsawShapeStyle style)
{
	wxPoint * points(NULL);
	bool bDrawBevel = true;
	wxColour bevelBright(200,200,200), bevelDarker(50,50,50);	
	if(dc.GetPen() == *wxTRANSPARENT_PEN)
	{
		wxColour aux;
		aux = bevelBright;
		bevelBright = bevelDarker;
		bevelDarker = aux;		
	}

	switch(style)
	{
	case wxJigsawShapeStyle::wxJS_TYPE_NUMERIC:

		

		if(bDrawBevel)
		{
			wxPoint pos1(pos);
			wxSize size1(size);

			dc.SetPen(bevelDarker); 
			dc.DrawRoundedRectangle(pos1, size1, size1.GetHeight()/2);

			dc.SetPen(bevelBright); 			
			pos1.x += 1;
			pos1.y += 1;			
			dc.DrawRoundedRectangle(pos1, size1, size1.GetHeight()/2);

			dc.SetPen(*wxTRANSPARENT_PEN); 
			pos1.y -= 1;
			dc.DrawRoundedRectangle(pos1, size, size.GetHeight()/2);

			dc.SetPen(bevelDarker); 
			dc.DrawLine(pos1.x + size.GetHeight()/2, pos1.y, pos1.x + size.GetWidth() - size.GetHeight()/2, pos1.y);
		} 
		else 
		{
			dc.DrawRoundedRectangle(pos, size, size.GetHeight()/2);
		}

		break;
	case wxJigsawShapeStyle::wxJS_TYPE_BOOLEAN:
		// If it is possible to draw a shape then we will draw it
		if(size.GetWidth() >= size.GetHeight())
		{
			points = new wxPoint[7];
			points[0] = wxPoint(0, size.GetHeight()/2);
			points[1] = wxPoint(size.GetHeight()/2, 0);
			points[2] = wxPoint(size.GetWidth()-size.GetHeight()/2, 0);			
			points[3] = wxPoint(size.GetWidth(), size.GetHeight()/2);
			points[4] = wxPoint(size.GetWidth()-size.GetHeight()/2, size.GetHeight());
			points[5] = wxPoint(size.GetHeight()/2, size.GetHeight());
			points[6] = wxPoint(0, size.GetHeight()/2);
			dc.DrawPolygon(7, points, pos.x, pos.y);			

			if(bDrawBevel)
			{
				dc.SetPen(bevelDarker); 
				dc.DrawLines(3, points, pos.x, pos.y);	

				dc.SetPen(bevelBright); 
				dc.DrawLines(4, &points[3], pos.x, pos.y);	
			} 

			wxDELETEA(points);
		}
		else // If it is impossible to draw a shape then we will draw a rectangle
		{
			dc.DrawRectangle(pos, size);
		}
		break;
	case wxJigsawShapeStyle::wxJS_TYPE_STRING:
		// If it is possible to draw a shape then we will draw it
		if(size.GetWidth() >= size.GetHeight())
		{
			/*
			1/3,1
			1/3,2/3
			0,2/3
			0,1/3
			1/3,1/3
			1/3,0
			*/
			points = new wxPoint[13];

			points[0] = wxPoint(size.GetHeight()/3.0, size.GetHeight());
			points[1] = wxPoint(size.GetHeight()/3.0, 2*size.GetHeight()/3.0);
			points[2] = wxPoint(0, 2*size.GetHeight()/3.0);
			points[3] = wxPoint(0, size.GetHeight()/3.0);
			points[4] = wxPoint(size.GetHeight()/3.0, size.GetHeight()/3.0);
			points[5] = wxPoint(size.GetHeight()/3.0, 0);

			points[6] = wxPoint(size.GetWidth()-points[5].x, points[5].y);
			points[7] = wxPoint(size.GetWidth()-points[4].x, points[4].y);
			points[8] = wxPoint(size.GetWidth()-points[3].x, points[3].y);
			points[9] = wxPoint(size.GetWidth()-points[2].x, points[2].y);
			points[10] = wxPoint(size.GetWidth()-points[1].x, points[1].y);
			points[11] = wxPoint(size.GetWidth()-points[0].x, points[0].y);

			points[12] = points[0];

			dc.DrawPolygon(13, points, pos.x, pos.y);			

			if(bDrawBevel)
			{
				dc.SetPen(bevelDarker); 
				dc.DrawLines(7, points, pos.x, pos.y);	

				dc.SetPen(bevelBright); 
				dc.DrawLines(6, &points[7], pos.x, pos.y);	
			} 

			wxDELETEA(points);
		}
		else // If it is impossible to draw a shape then we will draw a rectangle
		{
			dc.DrawRectangle(pos, size);
		}
		break;
	case wxJigsawShapeStyle::wxJS_TYPE_NONE:
	default:
		dc.DrawRoundedRectangle(pos, size, 4);
		break;
	}
}
コード例 #22
0
ファイル: label.cpp プロジェクト: sqba/floopy
void CLabel::DrawBG(wxDC& dc, wxRect& rc)
{
	CTrack *track = getTrack();
	m_rcLabel = rc;

	wxBrush oldBrush = dc.GetBrush();
	wxPen oldpen = dc.GetPen();

	wxPen pen( *wxMEDIUM_GREY_PEN );
	pen.SetWidth(1);
	dc.SetPen( pen );

	//wxBrush brush(m_color, (IsSelected() ? wxCROSSDIAG_HATCH : wxSOLID));
	wxBrush brush(track->GetBGColor(), wxSOLID);
	dc.SetBrush(brush);

	int left, top, width, height;

	if(m_bDrawAquaBG)
	{
		// Draw aqua background
		left   = 0;
		top    = rc.GetTop();
		width  = rc.GetWidth()-left;
		height = rc.GetHeight();
		//dc.DrawRectangle(left, top, width, height);
		wxRect rc(left+1, top+1, width-2, height-2);
		DrawAquaRect(dc, rc, 4);
	}
	else
	{
		// Draw background
		left   = 1;//m_nLevel*4+2;
		top    = rc.GetTop()+1;
		width  = rc.GetWidth()-1;//left-3;
		height = rc.GetHeight()-2;
		//dc.DrawRoundedRectangle(left, top, width, height, 4);
		//DrawRect3D(dc, wxRect(left, top, width, height));
		DrawRect3D(dc, rc);
	}

	dc.SetTextForeground( track->GetForeColor() );
	wxFont oldFont = dc.GetFont();
	wxFont font(9, wxSWISS, wxNORMAL, wxBOLD);
	//wxFont font = oldFont;
	//font.SetWeight(IsSelected() ? wxBOLD : wxNORMAL);
	//font.SetPointSize(GetHeight() / 4);
	font.SetPointSize( 9 );
	dc.SetFont(font);
	//wxFont font(12, wxDEFAULT, wxITALIC, (IsSelected() ? wxBOLD : wxNORMAL));
	//dc.SetFont(font);
	////dc.SetFont((IsSelected() ? *wxITALIC_FONT : *wxNORMAL_FONT));

	// Get text dimensions
	wxCoord w=0, h=0;
	wxString csName;
	track->GetName(csName);
	dc.GetTextExtent(csName, &w, &h);

	/*int ptSize = GetHeight() / 2;
	// Get text dimensions
	wxCoord w=0, h=0;
	do {
		font.SetPointSize(ptSize);
		dc.GetTextExtent(m_name, &w, &h);
		ptSize--;
	} while (w>width && ptSize > 5);*/


	// Draw text
	int x = left + 5;//width/2 - w/2;
	int y = (rc.GetTop() + (rc.GetHeight()/4) - h/2);
	dc.DrawText( csName, x, y );
	m_rcLabel.SetHeight(rc.GetHeight());

/*
	int n = rc.GetHeight()/2-2;
	if(n > 20)
		n = 20;
	drawLoopSign(dc,  wxRect(5, top+height-n-2, n, n));
	drawCacheSign(dc, wxRect(n+5+1, top+height-n-2, n, n));
*/
	wxRect rcTmp = getPathRect(rc);
	m_pPathCtrl->DrawBG(dc, rcTmp);


	dc.SetFont(oldFont);
	dc.SetPen(oldpen);
	dc.SetBrush( oldBrush );
}
コード例 #23
0
ファイル: plotxy.cpp プロジェクト: betrixed/AGW
void PlotXY::OnDraw(wxDC& dc)
{
    agw::PlotLua* pl = plotLua_.get();

    std::vector<agw::PlotLayer_sptr>& layers = pl->layers_;

    if (layers.size() == 0)
        return;

    int xv, yv;

    GetVirtualSize(&xv, &yv);

    PixelWorld& pw = pl->world_;

    pw.calc(xv,yv);
    pw.calcScales(layers);


    wxBrush backBrush(pw.backColor_);
    dc.SetBackground(backBrush);
    dc.DrawRectangle(0,0,xv,yv);


    wxPen axePen(pw.axisColor_);
    auto savePen = dc.GetPen();
    dc.SetPen(axePen);

    auto xright = pw.left_ + pw.xspan_;
    auto xbottom = pw.top_ + pw.yspan_;
    if (pw.leftFrame_)
        dc.DrawLine(pw.left_, pw.top_,pw.left_, xbottom);
    if (pw.topFrame_)
        dc.DrawLine(pw.left_, pw.top_, xright, pw.top_);
    if (pw.rightFrame_)
        dc.DrawLine(xright, pw.top_,xright, xbottom);
    if (pw.bottomFrame_)
        dc.DrawLine(xright, xbottom, pw.left_, xbottom);

    pw.yScale_.renderDC(dc,pw);

	// bottom axis,
	pw.xScale_.renderDC(dc,pw);

	auto it = layers.begin();
	auto fin = layers.end();

    for( ; it != fin; it++)
    {
		PlotLayer* p = it->get();

        if (p->isVisible())
            p->renderDC(dc, pw);

    }

    dc.SetPen(savePen);

    std::vector<PlotLayer_sptr>& text = pl->text_.labels_;
    it = text.begin();
    fin = text.end();

    for( ; it != fin; it++)
    {
        PlotLayer* p = it->get();
        p->setPlot(plotLua_);

        if (p->isVisible())
            p->renderDC(dc, pw);
    }

    PlotLayer* p = pl->text_.legend_.get();
    if (p && p->isVisible())
    {
        p->setPlot(plotLua_);
        p->renderDC(dc, pw);

    }

}
コード例 #24
0
ファイル: aplot.cpp プロジェクト: darckense/fityk
void AuxPlot::draw(wxDC &dc, bool monochrome)
{
    //printf("AuxPlot::draw()\n");
    int pos = frame->get_focused_data_index();
    Data const* data = ftk->get_data(pos);
    Model const* model = ftk->get_model(pos);
    if (auto_zoom_y_ || fit_y_once_) {
        fit_y_zoom(data, model);
        fit_y_once_ = false;
    }
    const int pixel_width = get_pixel_width(dc);
    const int pixel_height = get_pixel_height(dc);
    set_scale(pixel_width, pixel_height);
    if (monochrome) {
        dc.SetPen(*wxBLACK_PEN);
        dc.SetBrush(*wxBLACK_BRUSH);
    }
    else
        dc.SetPen(wxPen(xAxisCol, pen_width));

    if (mark_peak_pos_) {
        v_foreach (int, i, model->get_ff().idx) {
            realt x;
            if (ftk->mgr.get_function(*i)->get_center(&x)) {
                int X = xs.px(x - model->zero_shift(x));
                dc.DrawLine(X, 0, X, pixel_height);
            }
        }
    }

    if (kind_ == apk_empty || data->is_empty())
        return;

    if (x_axis_visible) {
        int Y0 = ys.px(0.);
        dc.DrawLine (0, Y0, pixel_width, Y0);
        if (kind_ == apk_diff)
            draw_zoom_text(dc, !monochrome);
    }
    if (y_axis_visible) {
        int X0 = xs.px(0.);
        dc.DrawLine (X0, 0, X0, pixel_height);
    }
    if (ytics_visible) {
        fityk::Rect rect(0, 0, ys.val(pixel_height), ys.val(0));
        draw_ytics(dc, rect, !monochrome);
    }

    double (*f)(vector<Point>::const_iterator, Model const*) = NULL;
    bool cummulative = false;
    if (kind_ == apk_diff)
        f = reversed_diff_ ? rdiff_of_data_for_draw_data
                           : diff_of_data_for_draw_data;
    else if (kind_ == apk_diff_stddev)
        f = reversed_diff_ ? rdiff_stddev_of_data_for_draw_data
                           : diff_stddev_of_data_for_draw_data;
    else if (kind_ == apk_diff_y_perc)
        f = reversed_diff_ ? rdiff_y_perc_of_data_for_draw_data
                           : diff_y_perc_of_data_for_draw_data;
    else if (kind_ == apk_cum_chi2) {
        f = diff_chi2_of_data_for_draw_data;
        cummulative = true;
    }
    wxColour col = monochrome ? dc.GetPen().GetColour() : wxNullColour;
    draw_data (dc, f, data, model, col, col, 0, cummulative);
}
コード例 #25
0
ファイル: dropdown.cpp プロジェクト: vata/xarino
wxSize DropDown::HandleDrawItemInternal(wxDC& dc, const wxRect& Rect, INT32 item, INT32 flags, BOOL Draw)
{
	const INT32 border = 2;

	if (CCamApp::IsDisabled())			// Inside an error handler
		return(wxDefaultSize);

	wxOwnerDrawnComboBox * pGadget = GetBox();

//	if ((INT32)pInfo->itemID == -1 || (INT32)pInfo->itemData == -1)	// Draw item -1: just exit
//		return(FALSE);

	void * ItemData = GetItemData(item);
		// Determine if it is a divider item
	if (!ItemData)
	{
		// It's a divider, so draw it specially - it is a simple black line across the center of the rectangle
		wxCoord midpoint = Rect.GetTop()+Rect.GetHeight()/2;
		if (Draw)
		{
			wxPen OldPen=dc.GetPen();
			dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)));
			dc.DrawLine(Rect.GetLeft(), midpoint, Rect.GetRight()+1, midpoint);
			dc.SetPen(OldPen);
		}
		return(wxSize(-1,5));
	}

	// If we aren't drawing, we should get the size of the text and return that appopriately modified
	if (!Draw)
	{
		// Call the derived class
		wxRect def(-1,-1,-1,-1);
		wxSize TextSize = DrawText(ItemData, dc, def, item, flags, FALSE); // Rect is unused here as Draw is FALSE
		TextSize.x+=2*border;
		TextSize.y+=2*border; // This gives us the bounding rect as we leave some space around it
		if (HasIcon(ItemData))
		{
			// There is an icon. It's width is equal to the text height less 2 (deflated in both
			// directions. There is also a 6 pixel space
			TextSize.x += (TextSize.y-2)+6;
		}
		return TextSize;
	}
	
	wxRect rect=Rect;
	rect.Deflate(border);

	// Calculate where the colour splodge (if any) will go (also used to shift text to the right later)
	wxRect IconRect=rect;
	IconRect.Deflate(1);
	IconRect.SetWidth(IconRect.GetHeight());

	wxRect TextRect=rect;

	wxPalette * OldPal = NULL;

	// If it's a special item with a colour splodge, or a normal colour item, draw the colour splodge
	if (HasIcon(ItemData))
	{
		if (PaletteManager::UsePalette())
			OldPal = PaletteManager::StartPaintPalette(&dc);

		// Call the derived class to draw the icon
		if (Draw)
			DrawIcon(ItemData, dc, IconRect, !pGadget->IsEnabled(), flags);

		// Shift the text to the right of the icon
		INT32 shift=IconRect.GetWidth()+6;
		TextRect.Offset(shift,0);
		INT32 NewWidth=TextRect.GetWidth()-shift;
		TextRect.SetWidth(NewWidth<1?1:NewWidth);
	}
	
	if (TextRect.GetWidth()>1)		// if there's room to draw any text, draw it
	{
		// Call derived class to draw the text
		if (Draw)
			DrawText(ItemData, dc, TextRect, item, flags, TRUE);
	}

	// Restore the DC's previous palette if we selected our one in
	if (OldPal)
		PaletteManager::StopPaintPalette(&dc, OldPal);

	return(wxDefaultSize);
}
コード例 #26
0
ファイル: parameter.cpp プロジェクト: sqba/floopy
void CParameter::DrawFore(wxDC& dc, wxRect& rc)
{
	m_iSamplesPerPixel = m_pTracks->GetSamplesPerPixel();

	if(m_fMax == 0.f)
		return;

	m_fScale	= (float)rc.GetHeight() / (float)(m_fMax - m_fMin);
	int start	= m_pRegion->GetStartPos();
	int end		= m_pRegion->GetEndPos();
	int offset	= m_pRegion->GetStartOffset();
	int top		= rc.GetTop();
	int bottom	= rc.GetTop() + rc.GetHeight();
	int left	= rc.GetX() + 1;
	int right	= left + rc.GetWidth() - 1;
	float value = 0.f;
	int prevX	= left;
	int prevY	= bottom;
	int pos	= m_bAfterTrack ? 0 : start;
	bool bLoaded = false;

	bool bDrawCircle = true;

	if(!m_pInput->GetParamAt(pos, m_index, &value))
	{
		pos = m_pInput->GetPrevOffset(pos);
		bDrawCircle = false;
	}
	else
		bLoaded = true;

	wxPen oldpen = dc.GetPen();
	wxColor color = m_color;
	if( IsSelected() )
		color.Set(255-color.Red(), 255-color.Green(), 255-color.Blue());
	dc.SetPen( wxPen(color) );

	do {
		if(m_pInput->GetParamAt(pos, m_index, &value))
		{
			bLoaded = true;

			int x = pos;
			int y = (int)((float)bottom - (value * m_fScale));

			if(y>top && y<bottom)
			{
				if(m_bAfterTrack && offset>=0)
					x += start - offset;

				x /= m_iSamplesPerPixel;

				if(x <= left)
					prevX = left;
				else if(x >= right)
					y = prevY;
				else
				{
					dc.DrawLine(prevX, prevY, x, prevY);	// Horizontal line
					dc.DrawLine(x, prevY, x, y);			// Vertical line

					if( bDrawCircle )
					{
						if(m_pSelectedPoint &&
							m_pSelectedPoint->m_offset==pos &&
							m_pSelectedPoint->m_value==value)
						{
							dc.DrawRectangle(x-3, y-3, 6, 6);	// Selected parameter
						}
						else
							dc.DrawCircle(x, y, 3);				// Parameter
					}

					prevX = x;
				}

				bDrawCircle = true;

				prevY = y;
			}
		}
		pos = m_pInput->GetNextOffset(pos);
	} while ( pos>0 && pos<end && prevX<right );

	if(bLoaded && prevX<right) // there have been parameters!
		dc.DrawLine(prevX, prevY, right, prevY);

	dc.SetPen(oldpen);
}
コード例 #27
0
ファイル: wksp_layer_legend.cpp プロジェクト: am2222/SAGA-GIS
//---------------------------------------------------------
void CWKSP_Layer_Legend::Draw(wxDC &dc, double Zoom, double Zoom_Map, wxPoint Position, wxSize *pSize, bool bVertical)
{
	//-----------------------------------------------------
	m_Zoom		= Zoom > 0.0 ? Zoom : 1.0;
	m_Position	= Position;
	m_Size		= wxSize(BOX_WIDTH, 0);

	m_Zoom_Map	= Zoom_Map;
	m_bVertical	= bVertical;

	//-----------------------------------------------------
	m_oldPen	= dc.GetPen();
	m_oldBrush	= dc.GetBrush();
	m_oldFont	= dc.GetFont();

	//-----------------------------------------------------
	m_xBox		= m_Position.x;
	m_dxBox		= BOX_WIDTH;
	m_xTick		= m_xBox	+ m_dxBox;
	m_dxTick	= TICK_WIDTH;
	m_xText		= m_xTick	+ m_dxTick;

	//-----------------------------------------------------
	_Draw_Title(dc, FONT_TITLE, m_pLayer->Get_Object()->Get_Name());

	//-----------------------------------------------------
	switch( m_pLayer->Get_Type() )
	{
	case WKSP_ITEM_Shapes:
		switch( ((CWKSP_Shapes *)m_pLayer)->Get_Shapes()->Get_Type() )
		{
		case SHAPE_TYPE_Point:
		case SHAPE_TYPE_Points:
			_Draw_Point		(dc, (CWKSP_Shapes_Point   *)m_pLayer);
			break;

		case SHAPE_TYPE_Line:
			_Draw_Line		(dc, (CWKSP_Shapes_Line    *)m_pLayer);
			break;

		case SHAPE_TYPE_Polygon:
			_Draw_Polygon	(dc, (CWKSP_Shapes_Polygon *)m_pLayer);
			break;

		default:
			break;
		}
		break;

	case WKSP_ITEM_TIN:
		_Draw_TIN	(dc, (CWKSP_TIN        *)m_pLayer);
		break;

	case WKSP_ITEM_PointCloud:
//		_Draw_TIN	(dc, (CWKSP_PointCloud *)m_pLayer);
		break;

	case WKSP_ITEM_Grid:
		_Draw_Grid	(dc, (CWKSP_Grid       *)m_pLayer);
		break;

	default:
		break;
	}

	//-----------------------------------------------------
	dc.SetPen	(m_oldPen);
	dc.SetBrush	(m_oldBrush);
	dc.SetFont	(m_oldFont);

	//-----------------------------------------------------
	if( pSize )
	{
		*pSize	= m_Size;
	}
}
コード例 #28
0
ファイル: plotdraw.cpp プロジェクト: mdavis45419/osiris
void SplineDrawer::DrawSpline( double x, double y )
{
    wxCHECK_RET( m_dc, wxT("invalid window dc") );
    wxPen oldPen = m_dc->GetPen();

    bool is_selected = (oldPen == m_selPen);

    m_x1 = m_x2;
    m_y1 = m_y2;
    m_x2 = x;
    m_y2 = y;
    m_cx4 = (m_x1 + m_x2) / 2.0;
    m_cy4 = (m_y1 + m_y2) / 2.0;
    m_cx3 = (m_x1 + m_cx4) / 2.0;
    m_cy3 = (m_y1 + m_cy4) / 2.0;

    double xmid, ymid;
    double xx1, yy1, xx2, yy2, xx3, yy3, xx4, yy4;

    SplineStack *stack_top = m_splineStack;
    m_stack_count = 0;

    SPLINE_PUSH(m_cx1, m_cy1, m_cx2, m_cy2, m_cx3, m_cy3, m_cx4, m_cy4);

    while (m_stack_count > 0)
    {
        SPLINE_POP(xx1, yy1, xx2, yy2, xx3, yy3, xx4, yy4);

        xmid = (xx2 + xx3)/2.0;
        ymid = (yy2 + yy3)/2.0;
        if ((fabs(xx1 - xmid) < THRESHOLD) && (fabs(yy1 - ymid) < THRESHOLD) &&
            (fabs(xmid - xx4) < THRESHOLD) && (fabs(ymid - yy4) < THRESHOLD))
        {
            // FIXME - is this really necessary, better safe than sorry?
            double t1_last_x = m_last_x;
            double t1_last_y = m_last_y;
            double t1_xx1    = xx1;
            double t1_yy1    = yy1;
            if (ClipLineToRect(t1_last_x, t1_last_y, t1_xx1, t1_yy1, m_rect) != ClippedOut)
            {
                if (m_rangeSel && (m_rangeSel->Contains((m_last_x + xx1)/2) != is_selected))
                {
                    is_selected = is_selected ? false : true;
                    if (is_selected)
                        m_dc->SetPen(m_selPen);
                    else
                        m_dc->SetPen(m_curPen);
                }

                m_dc->DrawLine((int)t1_last_x, (int)t1_last_y, (int)t1_xx1, (int)t1_yy1);
            }

            double t2_xx1  = xx1;
            double t2_yy1  = yy1;
            double t2_xmid = xmid;
            double t2_ymid = ymid;
            if (ClipLineToRect(t2_xx1, t2_yy1, t2_xmid, t2_ymid, m_rect) != ClippedOut)
            {
                if (m_rangeSel && (m_rangeSel->Contains((xx1+xmid)/2) != is_selected))
                {
                    is_selected = is_selected ? false : true;
                    if (is_selected)
                        m_dc->SetPen(m_selPen);
                    else
                        m_dc->SetPen(m_curPen);
                }

                m_dc->DrawLine((int)t2_xx1, (int)t2_yy1, (int)t2_xmid, (int)t2_ymid);
            }

            m_last_x = xmid;
            m_last_y = ymid;
        }
        else
        {
            wxCHECK_RET(m_stack_count < SPLINE_STACK_DEPTH - 2, wxT("Spline stack overflow"));
            SPLINE_PUSH(xmid, ymid, (xmid + xx3)/2.0, (ymid + yy3)/2.0,
                        (xx3 + xx4)/2.0, (yy3 + yy4)/2.0, xx4, yy4);
            SPLINE_PUSH(xx1, yy1, (xx1 + xx2)/2.0, (yy1 + yy2)/2.0,
                        (xx2 + xmid)/2.0, (yy2 + ymid)/2.0, xmid, ymid);
        }
    }

    m_cx1 = m_cx4;
    m_cy1 = m_cy4;
    m_cx2 = (m_cx1 + m_x2) / 2.0;
    m_cy2 = (m_cy1 + m_y2) / 2.0;

    m_dc->SetPen(oldPen);
}