コード例 #1
0
STDMETHODIMP_(bool) CTextPro :: GenerateText (LONG lONr, CString sText, DWORD dwFlags, LONG *plTxtObjNr)
{
OBJSTATISTIK OS;
SEnObj  stEnObj;
		
	if (!m_pTextExt -> LoadState()) return false;
	
	INITSTRUCT(OS, OBJSTATISTIK);
	OS.lONr	= lONr;				// ObjektNummer
	if (!DEX_GetObjStatistik(OS)) 
		return false; 
			              
	if (OS.iObjTyp == OGFlaeche) 
		*stEnObj.pcGeo = 'F';	            
	else if (OS.iObjTyp == OGPunkt) 
		*stEnObj.pcGeo = 'P';	            
	else if (OS.iObjTyp == OGLinie) 
		*stEnObj.pcGeo = 'L';	            
	else 
		return false;
		
	if (!FlagTest (stEnObj, dwFlags)) 
		return false;

	stEnObj.lMerkCd = 0;  
	stEnObj.sTxt = sText;


// hier wird gleiche Funktion gerufen, die auch TRiAS zur Enumeration von Objekten ruft			
	if (!EnumObjs (lONr, true, &stEnObj)) 
		return false;
	*plTxtObjNr = stEnObj.lObjNr;

return true;
}
コード例 #2
0
ファイル: CountLinePoints.cpp プロジェクト: hkaiser/TRiAS
///////////////////////////////////////////////////////////////////////////////
// Berechnen dieser Objekteigenschaft
STDMETHODIMP CCountLinePoints::Eval (LONG lONr, LPSTR pBuffer, ULONG ulLen, ULONG *pulWritten)
{
//	AFX_MANAGE_STATE(AfxGetAppModuleState())
	if (NULL == pBuffer) return E_POINTER;

	_ASSERTE(0 != ulLen);
	_ASSERTE(!IsBadWritePtr(pBuffer, ulLen));

int iOTyp = DEX_GetObjectType(lONr);

	if (((OGLinie == iOTyp) ||
		(OGPunkt == iOTyp) ||
		(OGFlaeche == iOTyp) ||
		(OGKreis == iOTyp) )
		&& ulLen > 20) {		// 20 Zeichen werden zumindest gebraucht
	// nur für GeometrieObjekte
	OBJSTATISTIK OG;

		INITSTRUCT(OG, OBJSTATISTIK);
		OG.lONr = lONr;
		if (!DEX_GetObjStatistik(OG))
			return E_FAIL;		// irgend was ist faul

		ltoa (OG.lCnt, pBuffer, 10);
		if (pulWritten) 
			*pulWritten = strlen(pBuffer);

	// Infos für Kumulation sammeln
		RETURN_FAILED_HRESULT(m_CumPts -> AddValue (double(OG.lCnt), vtMissing));
		IncrementCount();			// Zähler der erfolgreichen Aufrufe
		return S_OK;
	}
	return E_FAIL;		// ObjeProperty existiert nicht
}
コード例 #3
0
ファイル: GeoObj.cpp プロジェクト: hkaiser/TRiAS
///////////////////////////////////////////////////////////////////////////////
// Objektgeometrie besorgen 
bool CObjGeometrie::FInit (bool fStatisticsOnly)
{
// Statistik anfordern
	if (!DEX_GetObjStatistik (*this))
		return false;

	if (fStatisticsOnly)
		return true;

// Felder anfordern
	ATLTRY(pdblX = new double [lCnt]);
	ATLTRY(pdblY = new double [lCnt]);
	if (pdblX == NULL || pdblY == NULL) 
		return false;
		
	if (iKCnt > 0) {
		if (iObjTyp == OGFlaeche) {
			ATLTRY(plCnt = new long [iKCnt]);
			if (plCnt == NULL) 
				return false;
		} 
		else if (iObjTyp == OGText) {
			((TEXTGEOMETRIE &)*this).pText = new char [iKCnt+1];
			if (((TEXTGEOMETRIE &)*this).pText == NULL) 
				return false;
		}
	}

// Geometrie holen
	iFlags |= OGConverted;
	if (!DEX_GetObjGeometrie (*this)) 
		return false;

// bei Linien/Flächen vergleichbare Position herstellen
bool fResult = true;

	if (OGFlaeche == iObjTyp)
	{
		fResult = AdjustAreaGeometry();
		fResult &= AdjustIslands();	// Inseln sortieren
	}
	else if (OGLinie == iObjTyp)
		fResult = AdjustLineGeometry();

// Hashwerte berechnen
	if (1.0 == m_dKoeff) {
		m_lXHash = HashKoords(&X(0), lCnt*sizeof(double));
		m_lYHash = HashKoords(&Y(0), lCnt*sizeof(double));
	}
	else {
		m_lXHash = HashKoordsTolerance(&X(0), lCnt, m_dKoeff);
		m_lYHash = HashKoordsTolerance(&Y(0), lCnt, m_dKoeff);
	}
	return fResult;
}