Beispiel #1
0
int main()
{
    CMapPtrToPtr map;

    if( !map.IsEmpty() ) _fail;
    if( map.GetCount() != 0 ) _fail;
    if( map.GetSize() != 0 ) _fail;

    map.SetAt( (void *)0, (void *)0 );
    map.SetAt( (void *)1, (void *)1 );
    map.SetAt( (void *)2, (void *)2 );

    void *value;
    if( !map.Lookup( (void *)0, value ) ) _fail;
    if( value != (void *)0 ) _fail;
    if( !map.Lookup( (void *)1, value ) ) _fail;
    if( value != (void *)1 ) _fail;
    if( !map.Lookup( (void *)2, value ) ) _fail;
    if( value != (void *)2 ) _fail;
    if( map.Lookup( (void *)3, value ) ) _fail;

    POSITION    position = map.GetStartPosition();
    void        *key;
    BOOL        bFound0 = FALSE;
    BOOL        bFound1 = FALSE;
    BOOL        bFound2 = FALSE;
    while( position != NULL ) {
        map.GetNextAssoc( position, key, value );
        switch( (INT_PTR)key ) {
        case 0:
            if( bFound0 ) _fail;
            if( value != (void *)0 ) _fail;
            bFound0 = TRUE;
            break;
        case 1:
            if( bFound1 ) _fail;
            if( value != (void *)1 ) _fail;
            bFound1 = TRUE;
            break;
        case 2:
            if( bFound2 ) _fail;
            if( value != (void *)2 ) _fail;
            bFound2 = TRUE;
            break;
        default:
            _fail;
            break;
        }
    }
    if( !bFound0 ) _fail;
    if( !bFound1 ) _fail;
    if( !bFound2 ) _fail;

    map.RemoveKey( (void *)0 );
    if( map.Lookup( (void *)0, value ) ) _fail;

    _PASS;
}
void CedExporter::RecordLocations(const CePoint& p, CMapPtrToPtr& locIndex) 
{
	//CString s;
	//s.Format("Process point %s", p.FormatKey());
	//Log(s);

	//FILE* log = 0;
	//if (p.FormatKey() == "2632804")
	//	log = LogFile;

	CPtrArray locs;
	const CeLocation* loc = p.GetpVertex();
	GetAllCoincidentLocations(loc, locs, LogFile);

	//if (locs.GetSize() != 1)
	//{
	//	CString s;
	//	s.Format("%d locs", locs.GetSize());
	//	Log(s);
	//}

	for (int i=0; i<locs.GetSize(); i++)
	{
		void* pLoc = locs.GetAt(i);
		locIndex.SetAt(pLoc, 0);
	}
}
Beispiel #3
0
void CCalendarDlg::OnCalendarMarkSelected() 
{
	CDWordArray dwaSelection;
	m_pCalendarCtrl->GetSelectedItems(dwaSelection);
	for(int i=0; i<dwaSelection.GetSize(); i++)
	{
		CalendarDataItem* p = NULL;
		if(!g_CalendarData.Lookup((void*)dwaSelection[i], (void*&)p))
		{
			p = new CalendarDataItem;
			g_CalendarData.SetAt((void*)dwaSelection[i], (void*)p);
		}
		p->bMarked = true;
	}
	m_pCalendarCtrl->UpdateCells();
}
void CedExporter::CheckForExtraPoint(const CeLocation* loc, CMapPtrToPtr& locIndex, IdFactory& idf, CPtrArray& extraPoints)
{
	// Nothing to do if the location has already been noted
	void* x;
	if (locIndex.Lookup((void*)loc, x))
		return;

	CString msg;
	msg.Format("Recording extra point for %x", (int)loc);
	Log(msg);

	// Generate an extra point
	unsigned int entityId = 0;
	PointFeature_c* p = new PointFeature_c(idf, entityId, *loc);

	//msg.Format("Added point %d", p->Stub->InternalId);
	//Log(msg);

	extraPoints.Add(p);
	locIndex.SetAt((void*)loc, (void*)p->Stub->InternalId); // I don't think we really need the ID, but hold it just in case
}
Beispiel #5
0
void CCalendarDlg::OnCalendarAddEntryToSelected() 
{
	// TODO: Add your command handler code here
	CCalendarInputDlg dlg;
	if(dlg.DoModal() == IDOK && !dlg.m_Text.IsEmpty())
	{
		CDWordArray dwaSelection;
		m_pCalendarCtrl->GetSelectedItems(dwaSelection);
		for(int i=0; i<dwaSelection.GetSize(); i++)
		{
			CalendarDataItem* p = NULL;
			if(!g_CalendarData.Lookup((void*)dwaSelection[i], (void*&)p))
			{
				p = new CalendarDataItem;
				p->bMarked = false;
				g_CalendarData.SetAt((void*)dwaSelection[i], (void*)p);
			}
			p->csLines.Add(dlg.m_Text);
		}
		m_pCalendarCtrl->UpdateCells();
	}	
}
void CedExporter::LoadValidData(CMapPtrToPtr& validData, CeMap* cedFile)
{
#ifdef _CEDIT
	// Generate an index of valid objects
	void* ptr=0;
	os_typespec* curts=0;
	os_int32 count=0;
	os_object_cursor c(os_database::of(cedFile));

	for ( c.first(); c.more(); c.next() )
	{
		if ( c.current(ptr,curts,count) )
		{
			validData.SetAt(ptr, 0);
		}
	}

	CString a;
	a.Format("Number of objects=%d", validData.GetCount());
	AfxMessageBox(a);
#endif
}