Ejemplo n.º 1
0
void CPathSelection::IsControlPointVisible(IPDSubPath* subpath, int nAnchorsSelected, int ntotalpoints, int npt, BOOL* c1, BOOL* c2)
{
	long npoints;
	subpath->get_pointCount(&npoints);

	int index = ntotalpoints + npt;
	int nextIndex = (npt < npoints-1)? index+1: ntotalpoints;
	int prevIndex = (npt > 0)? index-1: ntotalpoints+npoints-1;

	BOOL indexSelected = IsAnchorSelected(index);

	if (IsSegmentSelected(prevIndex) || (indexSelected && nAnchorsSelected < 2))
	{
		*c1 = true;
	}
	else
		*c1 = false;

	if (IsSegmentSelected(index) || (indexSelected && nAnchorsSelected < 2))
	{
		*c2 = true;
	}
	else
		*c2 = false;
}
Ejemplo n.º 2
0
void CPathSelection::SelectSegment(int index)
{
	ATLASSERT(!IsSegmentSelected(index));

	for (int i = 0; i < m_selectedSegments.GetSize(); i++)
	{
		if (index < m_selectedSegments[i]) break;
	}
	m_selectedSegments.InsertAt(i, index);
}
Ejemplo n.º 3
0
bool ODSelect::IsSelectableSegmentSelected( float slat, float slon, SelectItem *pFindSel )
{
    CalcSelectRadius();

    float a = pFindSel->m_slat;
    float b = pFindSel->m_slat2;
    float c = pFindSel->m_slon;
    float d = pFindSel->m_slon2;

    return IsSegmentSelected( a, b, c, d, slat, slon );
}
Ejemplo n.º 4
0
SelectableItemList ODSelect::FindSelectionList( float slat, float slon, int fseltype )
{
    float a, b, c, d;
    SelectItem *pFindSel;
    SelectableItemList ret_list;

    CalcSelectRadius();
    
    // Check and see if the boat is within the selection area
    if( ( fabs( slat - g_pfFix.Lat ) > selectRadius ) || ( fabs( slon - g_pfFix.Lon ) > selectRadius ) ) {
    
    //    Iterate on the list
        wxSelectableItemListNode *node = pSelectList->GetFirst();

        while( node ) {
            pFindSel = node->GetData();
            if( pFindSel->m_seltype == fseltype ) {
                switch( fseltype ){
                    case SELTYPE_ODPOINT:
                        if( ( fabs( slat - pFindSel->m_slat ) < selectRadius )
                                && ( fabs( slon - pFindSel->m_slon ) < selectRadius ) ) {
                            ret_list.Append( pFindSel );
                        }
                        break;
                    case SELTYPE_PATHSEGMENT:
                        a = pFindSel->m_slat;
                        b = pFindSel->m_slat2;
                        c = pFindSel->m_slon;
                        d = pFindSel->m_slon2;

                        if( IsSegmentSelected( a, b, c, d, slat, slon ) ) ret_list.Append( pFindSel );

                        break;
                    default:
                        break;
                }
            }

            node = node->GetNext();
        }
    }

    return ret_list;
}
Ejemplo n.º 5
0
SelectItem *ODSelect::FindSelection( float slat, float slon, int fseltype )
{
    float a, b, c, d;
    SelectItem *pFindSel;

    CalcSelectRadius();

//    Iterate on the list
    wxSelectableItemListNode *node = pSelectList->GetFirst();

    while( node ) {
        pFindSel = node->GetData();
        if( pFindSel->m_seltype == fseltype ) {
            switch( fseltype ){
                case SELTYPE_OCPNPOINT:
                    a = fabs( slat - pFindSel->m_slat );
                    b = fabs( slon - pFindSel->m_slon );

                    if( ( fabs( slat - pFindSel->m_slat ) < selectRadius )
                            && ( fabs( slon - pFindSel->m_slon ) < selectRadius ) ) goto find_ok;
                    break;
                case SELTYPE_PATHSEGMENT: 
                    a = pFindSel->m_slat;
                    b = pFindSel->m_slat2;
                    c = pFindSel->m_slon;
                    d = pFindSel->m_slon2;

//                    if( IsSegmentSelected( a, b, c, d, slat, slon ) ) goto find_ok;
                    if( IsSegmentSelected( a, b, c, d, slat, slon ) ) return pFindSel;
                    break;
                default:
                    break;
            }
        }

        node = node->GetNext();
    }

    return NULL;
    find_ok: return pFindSel;
}