//--------------------------------------------------------- void CWKSP_Layer_Legend::_Draw_Continuum(wxDC &dc, int y, double zFactor) { int i; double zMin, zMax; //----------------------------------------------------- zMin = m_pClassify->Get_RelativeToMetric(0.0); zMax = m_pClassify->Get_RelativeToMetric(1.0); //----------------------------------------------------- if( zMin >= zMax ) { if( m_pLayer->Get_Value_Range() > 0.0 ) { i = m_pClassify->Get_Class_Count() - 1; _Draw_Box (dc, y, BOX_HEIGHT, Get_Color_asWX(m_pClassify->Get_Class_Color(i))); _Draw_Label (dc, y, m_pClassify->Get_Class_Name(i), TEXTALIGN_TOP); y += BOX_HEIGHT; } i = 0; _Draw_Box (dc, y, BOX_HEIGHT, Get_Color_asWX(m_pClassify->Get_Class_Color(i))); _Draw_Label (dc, y, m_pClassify->Get_Class_Name(i), TEXTALIGN_TOP); } //----------------------------------------------------- else if( METRIC_HEIGHT > m_pClassify->Get_Class_Count() * BOX_HEIGHT ) { _Draw_Boxes(dc, y); } //----------------------------------------------------- else { int dyFont; double yToDC, dz; _Set_Font(dc, FONT_LABEL); dc.GetTextExtent(wxString::Format(wxT("01234567")), &i, &dyFont); zMin *= zFactor; zMax *= zFactor; yToDC = METRIC_HEIGHT / (zMax - zMin); dz = pow(10.0, floor(log10(zMax - zMin)) - 1.0); while( yToDC * dz < dyFont ) dz *= 2.0; yToDC = METRIC_HEIGHT / (double)m_pClassify->Get_Class_Count(); if( m_bVertical ) { _Draw_Continuum_V(dc, y, yToDC, zMin, zMax, zFactor, dz, dyFont); } else { _Draw_Continuum_H(dc, y, yToDC, zMin, zMax, zFactor, dz, dyFont); } } }
//--------------------------------------------------------- void CWKSP_Layer_Legend::_Draw_Boxes(wxDC &dc, int y) { for(int i=m_pClassify->Get_Class_Count()-1; i>=0; i--, y+=BOX_HEIGHT) { _Draw_Box (dc, y, BOX_HEIGHT, Get_Color_asWX(m_pClassify->Get_Class_Color(i))); _Draw_Label (dc, y, m_pClassify->Get_Class_Name(i), TEXTALIGN_TOP); } }
//--------------------------------------------------------- void CWKSP_Layer_Legend::_Draw_Line(wxDC &dc, CWKSP_Shapes_Line *pLayer) { bool bSize; int min_Size, max_Size, iSize, y; double min_Value, dValue; wxString Name, Name_Size; wxPen Pen; //----------------------------------------------------- m_BoxStyle = BOXSTYLE_LINE; m_Box_bFill = false; m_Box_bOutline = false; //----------------------------------------------------- bSize = pLayer->Get_Style_Size(min_Size, max_Size, min_Value, dValue, &Name_Size); pLayer->Get_Style(Pen, &Name); if( m_pClassify->Get_Mode() != CLASSIFY_UNIQUE || !bSize ) { dc.SetPen(Pen); if( Name.Length() > 0 ) { _Draw_Title(dc, FONT_SUBTITLE, Name); } _Draw_Boxes(dc, m_Position.y); } //----------------------------------------------------- if( bSize ) { _Draw_Title(dc, FONT_SUBTITLE, Name_Size); for(iSize=min_Size; iSize<=max_Size; iSize++) { Pen.SetWidth(iSize); dc.SetPen(Pen); y = m_Position.y; _Draw_Box (dc, y, BOX_HEIGHT, Pen.GetColour()); _Draw_Label (dc, y, wxString::Format(wxT("%f"), min_Value + (iSize - min_Size) / dValue), TEXTALIGN_TOP); } } }
//--------------------------------------------------------- bool CSG_3DView_Canvas::Draw(void) { if( !m_Image_pRGB || m_Image_NX < 1 || m_Image_NY < 1 ) { return( false ); } _Draw_Background(); //------------------------------------------------- if( m_Data_Min.x >= m_Data_Max.x || m_Data_Min.y >= m_Data_Max.y || m_Data_Min.z > m_Data_Max.z ) { return( false ); } //------------------------------------------------- if( !On_Before_Draw() ) { return( false ); } //------------------------------------------------- m_Projector.Set_Center( m_Data_Min.x + 0.5 * (m_Data_Max.x - m_Data_Min.x), m_Data_Min.y + 0.5 * (m_Data_Max.y - m_Data_Min.y), m_Data_Min.z + 0.5 * (m_Data_Max.z - m_Data_Min.z) ); m_Projector.Set_Scale( (m_Image_NX / (double)m_Image_NY) > ((m_Data_Max.x - m_Data_Min.x) / (m_Data_Max.y - m_Data_Min.y)) ? m_Image_NX / (m_Data_Max.x - m_Data_Min.x) : m_Image_NY / (m_Data_Max.y - m_Data_Min.y) ); //------------------------------------------------- if( m_bStereo == false ) { m_Image_zMax.Assign(999999.0); m_Color_Mode = COLOR_MODE_RGB; On_Draw(); _Draw_Box(); } //----------------------------------------------------- else { double dRotate = M_DEG_TO_RAD * 0.5 * m_dStereo; double yRotate = m_Projector.Get_yRotation(); double dShift = -0.01 * m_Image_NX; double xShift = m_Projector.Get_xShift(); //------------------------------------------------- m_Image_zMax.Assign(999999.0); m_Projector.Set_xShift (xShift - dShift ); m_Projector.Set_yRotation(yRotate - dRotate); m_Color_Mode = COLOR_MODE_RED; On_Draw(); _Draw_Box(); //------------------------------------------------- m_Image_zMax.Assign(999999.0); m_Projector.Set_xShift (xShift + dShift ); m_Projector.Set_yRotation(yRotate + dRotate); m_Color_Mode = COLOR_MODE_CYAN; On_Draw(); _Draw_Box(); //------------------------------------------------- m_Projector.Set_xShift (xShift ); m_Projector.Set_yRotation(yRotate); } return( true ); }