📄 wksp_tin.cpp
字号:
///////////////////////////////////////////////////////////
// //
// SAGA //
// //
// System for Automated Geoscientific Analyses //
// //
// User Interface //
// //
// Program: SAGA //
// //
//-------------------------------------------------------//
// //
// WKSP_TIN.cpp //
// //
// Copyright (C) 2005 by Olaf Conrad //
// //
//-------------------------------------------------------//
// //
// This file is part of 'SAGA - System for Automated //
// Geoscientific Analyses'. SAGA is free software; you //
// can redistribute it and/or modify it under the terms //
// of the GNU General Public License as published by the //
// Free Software Foundation; version 2 of the License. //
// //
// SAGA is distributed in the hope that it will be //
// useful, but WITHOUT ANY WARRANTY; without even the //
// implied warranty of MERCHANTABILITY or FITNESS FOR A //
// PARTICULAR PURPOSE. See the GNU General Public //
// License for more details. //
// //
// You should have received a copy of the GNU General //
// Public License along with this program; if not, //
// write to the Free Software Foundation, Inc., //
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, //
// USA. //
// //
//-------------------------------------------------------//
// //
// contact: Olaf Conrad //
// Institute of Geography //
// University of Goettingen //
// Goldschmidtstr. 5 //
// 37077 Goettingen //
// Germany //
// //
// e-mail: oconrad@saga-gis.org //
// //
///////////////////////////////////////////////////////////
//---------------------------------------------------------
///////////////////////////////////////////////////////////
// //
// //
// //
///////////////////////////////////////////////////////////
//---------------------------------------------------------
#include "res_commands.h"
#include "helper.h"
#include "wksp_map_control.h"
#include "wksp_layer_classify.h"
#include "wksp_tin.h"
#include "wksp_table.h"
///////////////////////////////////////////////////////////
// //
// //
// //
///////////////////////////////////////////////////////////
//---------------------------------------------------------
CWKSP_TIN::CWKSP_TIN(CSG_TIN *pTIN)
: CWKSP_Layer(pTIN)
{
m_pTIN = pTIN;
m_pTable = new CWKSP_Table(&m_pTIN->Get_Table(), this);
m_Edit_Attributes.Destroy();
m_Edit_Attributes.Add_Field(LNG("[CAP] Name") , TABLE_FIELDTYPE_String);
m_Edit_Attributes.Add_Field(LNG("[CAP] Value"), TABLE_FIELDTYPE_String);
Create_Parameters();
}
//---------------------------------------------------------
CWKSP_TIN::~CWKSP_TIN(void)
{
}
///////////////////////////////////////////////////////////
// //
// //
// //
///////////////////////////////////////////////////////////
//---------------------------------------------------------
wxString CWKSP_TIN::Get_Name(void)
{
return( wxString::Format(wxT("%02d. %s"), 1 + Get_ID(), m_pTIN->Get_Name()) );
}
//---------------------------------------------------------
wxString CWKSP_TIN::Get_Description(void)
{
wxString s;
//-----------------------------------------------------
s.Append(wxString::Format(wxT("<b>%s</b><table border=\"0\">"),
LNG("[CAP] TIN")
));
s.Append(wxString::Format(wxT("<tr><td>%s</td><td>%s</td></tr>"),
LNG("[CAP] Name") , m_pTIN->Get_Name()
));
s.Append(wxString::Format(wxT("<tr><td>%s</td><td>%s</td></tr>"),
LNG("[CAP] File") , m_pTIN->Get_File_Name()
));
s.Append(wxString::Format(wxT("<tr><td>%s</td><td>%d</td></tr>"),
LNG("[CAP] Points") , m_pTIN->Get_Point_Count()
));
s.Append(wxT("</table>"));
//-----------------------------------------------------
s.Append(wxString::Format(wxT("<hr><b>%s</b>"), LNG("[CAP] Table Description")));
s.Append(Get_TableInfo_asHTML(&m_pTIN->Get_Table()));
//-----------------------------------------------------
s.Append(wxString::Format(wxT("<hr><b>%s</b><font size=\"-1\">"), LNG("[CAP] Data History")));
s.Append(m_pTIN->Get_History().Get_HTML());
s.Append(wxString::Format(wxT("</font")));
//-----------------------------------------------------
return( s );
}
//---------------------------------------------------------
wxMenu * CWKSP_TIN::Get_Menu(void)
{
wxMenu *pMenu;
pMenu = new wxMenu(m_pTIN->Get_Name());
CMD_Menu_Add_Item(pMenu, false, ID_CMD_WKSP_ITEM_CLOSE);
CMD_Menu_Add_Item(pMenu, false, ID_CMD_TIN_SHOW);
return( pMenu );
}
///////////////////////////////////////////////////////////
// //
// //
// //
///////////////////////////////////////////////////////////
//---------------------------------------------------------
bool CWKSP_TIN::On_Command(int Cmd_ID)
{
// switch( Cmd_ID )
{
// default:
return( CWKSP_Layer::On_Command(Cmd_ID) );
}
// return( true );
}
//---------------------------------------------------------
bool CWKSP_TIN::On_Command_UI(wxUpdateUIEvent &event)
{
// switch( event.GetId() )
{
// default:
return( CWKSP_Layer::On_Command_UI(event) );
}
// return( true );
}
///////////////////////////////////////////////////////////
// //
// //
// //
///////////////////////////////////////////////////////////
//---------------------------------------------------------
void CWKSP_TIN::On_Create_Parameters(void)
{
//-----------------------------------------------------
// General...
m_Parameters.Add_Choice(
m_Parameters("NODE_METRIC") , "COLORS_ATTRIB" , LNG("[CAP] Attribute"),
LNG(""),
LNG("")
);
//-----------------------------------------------------
m_Parameters.Add_Value(
m_Parameters("NODE_DISPLAY") , "DISPLAY_POINTS" , LNG("[CAP] Show Points"),
LNG(""),
PARAMETER_TYPE_Bool, false
);
//-----------------------------------------------------
m_Parameters.Add_Value(
m_Parameters("NODE_DISPLAY") , "DISPLAY_EDGES" , LNG("[CAP] Show Edges"),
LNG(""),
PARAMETER_TYPE_Bool, true
);
//-----------------------------------------------------
m_Parameters.Add_Value(
m_Parameters("NODE_DISPLAY") , "DISPLAY_TRIANGES" , LNG("[CAP] Show Filled"),
LNG(""),
PARAMETER_TYPE_Bool, true
);
//-----------------------------------------------------
m_Parameters.Add_Value(
m_Parameters("NODE_DISPLAY") , "DISPLAY_TRANSPARENCY" , LNG("[CAP] Transparency [%]"),
LNG(""),
PARAMETER_TYPE_Double, 0.0, 0.0, true, 100.0, true
);
}
///////////////////////////////////////////////////////////
// //
// //
// //
///////////////////////////////////////////////////////////
//---------------------------------------------------------
void CWKSP_TIN::On_DataObject_Changed(void)
{
int i;
wxString sChoices;
for(i=0; i<m_pTIN->Get_Table().Get_Field_Count(); i++)
{
sChoices.Append(wxString::Format(wxT("%s|"), m_pTIN->Get_Table().Get_Field_Name(i)));
}
m_Parameters("COLORS_ATTRIB")->asChoice()->Set_Items(sChoices);
}
//---------------------------------------------------------
void CWKSP_TIN::On_Parameters_Changed(void)
{
if( (m_Color_Field = m_Parameters("COLORS_ATTRIB")->asInt()) >= m_pTIN->Get_Table().Get_Field_Count() )
{
m_Color_Field = -1;
}
long DefColor = m_Parameters("UNISYMBOL_COLOR")->asColor();
m_Color_Pen = wxColour(SG_GET_R(DefColor), SG_GET_G(DefColor), SG_GET_B(DefColor));
}
///////////////////////////////////////////////////////////
// //
// //
// //
///////////////////////////////////////////////////////////
//---------------------------------------------------------
int CWKSP_TIN::On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
{
if( !SG_STR_CMP(pParameter->Get_Identifier(), wxT("COLORS_ATTRIB")) )
{
int zField = pParameter->asInt();
pParameters->Get_Parameter("METRIC_ZRANGE")->asRange()->Set_Range(
m_pTIN->Get_Table().Get_MinValue(zField),
m_pTIN->Get_Table().Get_MaxValue(zField)
);
}
return( 1 );
}
///////////////////////////////////////////////////////////
// //
// //
// //
///////////////////////////////////////////////////////////
//---------------------------------------------------------
wxString CWKSP_TIN::Get_Value(CSG_Point ptWorld, double Epsilon)
{
return( LNG("") );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -