Пример #1
0
//---------------------------------------------------------
bool CSG_PointCloud::Del_Point(int iPoint)
{
    if( iPoint >= 0 && iPoint < Get_Count() )
    {
        if( is_Selected(iPoint) )
        {
            Select(iPoint, true);
        }

        m_Cursor	= m_Points[iPoint];

        for(int i=iPoint, j=iPoint+1; j<Get_Count(); i++, j++)
        {
            m_Points[i]	= m_Points[j];
        }

        m_Points[Get_Count() - 1]	= m_Cursor;

        m_Cursor	= NULL;

        _Dec_Array();

        Set_Modified();
        Set_Update_Flag();
        _Stats_Invalidate();

        return( true );
    }

    return( false );
}
Пример #2
0
//---------------------------------------------------------
bool CSG_PointCloud::Add_Point(double x, double y, double z)
{
    if( _Inc_Array() )
    {
        _Set_Field_Value(m_Cursor, 0, x);
        _Set_Field_Value(m_Cursor, 1, y);
        _Set_Field_Value(m_Cursor, 2, z);

        Set_Modified();
        Set_Update_Flag();
        _Stats_Invalidate();

        return( true );
    }

    return( false );
}
Пример #3
0
//---------------------------------------------------------
bool CSG_Table::_Load_DBase(const CSG_String &File_Name)
{
	int					iField;
	CSG_Table_DBase		dbf;
	CSG_Table_Record	*pRecord;

	//-----------------------------------------------------
	if( dbf.Open(File_Name) )
	{
		Destroy();

		for(iField=0; iField<dbf.Get_FieldCount(); iField++)
		{
			TSG_Data_Type	Type;

			switch( dbf.Get_FieldType(iField) )
			{
			case DBF_FT_LOGICAL:
				Type	= SG_DATATYPE_Char;
				break;

			case DBF_FT_CHARACTER:	default:
				Type	= SG_DATATYPE_String;
				break;

			case DBF_FT_DATE:
				Type	= SG_DATATYPE_Date;
				break;

			case DBF_FT_NUMERIC:
				Type	= dbf.Get_FieldDecimals(iField) > 0
						? SG_DATATYPE_Double
						: SG_DATATYPE_Long;
				break;
			}

			Add_Field(SG_STR_MBTOSG(dbf.Get_FieldName(iField)), Type);
		}

		//-------------------------------------------------
		if( dbf.Move_First() && dbf.Get_Record_Count() > 0 )
		{
			m_nRecords		= m_nBuffer	= dbf.Get_Record_Count();
			m_Records		= (CSG_Table_Record **)SG_Malloc(m_nRecords * sizeof(CSG_Table_Record *));

			for(int iRecord=0; iRecord<m_nRecords && SG_UI_Process_Set_Progress(iRecord, m_nRecords); iRecord++)
			{
				m_Records[iRecord]	= pRecord	= _Get_New_Record(iRecord);

				for(iField=0; iField<Get_Field_Count(); iField++)
				{
					switch( Get_Field_Type(iField) )
					{
					case SG_DATATYPE_Char:
						pRecord->Set_Value(iField, SG_STR_MBTOSG(dbf.asString(iField)) );
						break;

					case SG_DATATYPE_String:	default:
						pRecord->Set_Value(iField, SG_STR_MBTOSG(dbf.asString(iField)) );
						break;

					case SG_DATATYPE_Date:
						pRecord->Set_Value(iField, dbf.asDouble(iField) );
						break;

					case SG_DATATYPE_Long:
						pRecord->Set_Value(iField, dbf.asInt(iField) );
						break;

					case SG_DATATYPE_Double:
						pRecord->Set_Value(iField, dbf.asDouble(iField) );
						break;
					}
				}

				dbf.Move_Next();
			}

			SG_UI_Process_Set_Ready();

			Set_Modified(false);

			Set_Update_Flag();

			_Stats_Invalidate();
		}

		return( true );
	}

	return( false );
}