//---------------------------------------------------------
CSG_Shape * CSG_PointCloud::_Set_Shape(int iPoint)
{
    SG_UI_Progress_Lock(true);

    CSG_Shape	*pShape	= m_Shapes.Get_Shape(0);

    if( pShape->is_Modified() && m_Shapes_Index >= 0 && m_Shapes_Index < Get_Count() )
    {
        m_Cursor	= m_Points[m_Shapes_Index];

        for(int i=0; i<Get_Field_Count(); i++)
        {
            switch( Get_Field_Type(i) )
            {
            default:
                Set_Value(i, pShape->asDouble(i));
                break;

            case SG_DATATYPE_Date:
            case SG_DATATYPE_String:
                Set_Value(i, pShape->asString(i));
                break;
            }
        }

        Set_Value(0, pShape->Get_Point(0).x);
        Set_Value(1, pShape->Get_Point(0).y);
        Set_Value(2, pShape->Get_Z    (0)  );
    }

    if( iPoint >= 0 && iPoint < Get_Count() )
    {
        if(1|| iPoint != m_Shapes_Index )
        {
            m_Cursor	= m_Points[iPoint];

            pShape->Set_Point(Get_X(), Get_Y(), 0, 0);
            pShape->Set_Z    (Get_Z()         , 0, 0);

            for(int i=0; i<Get_Field_Count(); i++)
            {
                switch( Get_Field_Type(i) )
                {
                default:
                    pShape->Set_Value(i, Get_Value(i));
                    break;

                case SG_DATATYPE_Date:
                case SG_DATATYPE_String:
                {
                    CSG_String	s;

                    Get_Value(i, s);

                    pShape->Set_Value(i, s);
                }
                break;
                }
            }

            m_Shapes_Index	= iPoint;
            pShape->m_Index	= iPoint;
            pShape->Set_Selected(is_Selected(iPoint));
        }

        m_Shapes.Set_Modified(false);

        SG_UI_Progress_Lock(false);

        return( pShape );
    }

    m_Shapes_Index	= -1;

    SG_UI_Progress_Lock(false);

    return( NULL );
}