Ejemplo n.º 1
0
CXFA_Node* CXFA_FFWidgetHandler::CreatePasswordEdit(CXFA_Node* pParent,
                                                    CXFA_Node* pBefore) const {
  CXFA_Node* pField = CreateField(XFA_ELEMENT_PasswordEdit, pParent, pBefore);
  CXFA_Node* pBind = CreateCopyNode(XFA_ELEMENT_Bind, pField);
  pBind->SetEnum(XFA_ATTRIBUTE_Match, XFA_ATTRIBUTEENUM_None, FALSE);
  return pField;
}
Ejemplo n.º 2
0
CXFA_Node* CXFA_FFWidgetHandler::CreateRadioButton(CXFA_Node* pParent,
                                                   CXFA_Node* pBefore) const {
  CXFA_Node* pField = CreateField(XFA_ELEMENT_CheckButton, pParent, pBefore);
  CXFA_Node* pUi = pField->GetFirstChildByClass(XFA_ELEMENT_Ui);
  CXFA_Node* pWidget = pUi->GetFirstChildByClass(XFA_ELEMENT_CheckButton);
  pWidget->SetEnum(XFA_ATTRIBUTE_Shape, XFA_ATTRIBUTEENUM_Round);
  return pField;
}
Ejemplo n.º 3
0
static kbool_t FuelVM_VisitAssignNode(KonohaContext *kctx, KBuilder *builder, kNode *expr, void *thunk)
{
	/*
	 * [LetExpr] := lhs = rhs
	 * expr->NodeList = [NULL, lhs, rhs]
	 **/

	kNode *left = kNode_At(expr, 1);
	kNode *right = kNode_At(expr, 2);
	INode *Node;
	FuelIRBuilder *flbuilder = BLD(builder);
	if(left->node == KNode_Local) {
		enum TypeId type = ConvertToTypeId(kctx, left->attrTypeId);
		if((Node = IRBuilder_FindLocalVarByHash(flbuilder, type, left->index)) == 0) {
			Node = CreateLocal(flbuilder, type);
			IField_setHash((IField *) Node, left->index);
		}
		SUGAR VisitNode(kctx, builder, right, thunk);
		INode *RHS = FuelVM_getExpression(builder);
		//if(RHS->Type != Node->Type) {
		//	INode_setType(Node, RHS->Type);
		//}
		CreateUpdate(flbuilder, Node, RHS);
	}
	//else if(left->node == TEXPR_STACKTOP) {
	//	enum TypeId type = ConvertToTypeId(kctx, left->attrTypeId);
	//	uintptr_t Hash = (uintptr_t) left;
	//	if((Node = IRBuilder_FindLocalVarByHash(flbuilder, type, Hash)) == 0) {
	//		Node = CreateLocal(flbuilder, type);
	//		IField_setHash((IField *) Node, Hash);
	//		ARRAY_add(INodePtr, &BLD(builder)->Stack, Node);
	//	}
	//	SUGAR VisitNode(kctx, builder, right, thunk);
	//	INode *RHS = FuelVM_getExpression(builder);
	//	if(RHS->Type != Node->Type)
	//		INode_setType(Node, RHS->Type);
	//	CreateUpdate(BLD(builder), Node, RHS);
	//}
	else{
		assert(left->node == KNode_Field);
		SUGAR VisitNode(kctx, builder, right, thunk);
		kshort_t index  = (kshort_t)left->index;
		kshort_t xindex = (kshort_t)(left->index >> (sizeof(kshort_t)*8));

		INode *Left;
		if((Left = IRBuilder_FindLocalVarByHash(BLD(builder), TYPE_Object, index)) == 0) {
			Left = CreateLocal(BLD(builder), TYPE_Object);
			IField_setHash((IField *) Left, index);
		}
		enum TypeId type = ConvertToTypeId(kctx, left->attrTypeId);
		Node = CreateField(BLD(builder), FieldScope, type, Left, xindex);
		SUGAR VisitNode(kctx, builder, right, thunk);
		CreateUpdate(BLD(builder), Node, FuelVM_getExpression(builder));
	}
	builder->Value = Node;
	return true;
}
Ejemplo n.º 4
0
/************************************************************************************
函数名称:
	CFieldList::Modify
功能说明:
	修改一个字段
详细解释:

出入参数:
	[in,out]nIndex:旧字段的位置
	[in,out]pField :新的字段
返回类型:

制作:
	Eric 2002-9-4
修改:

************************************************************************************/
bool CFieldList::Modify(int nIndex,CFieldType NewFieldType)
{
	CField *pField = this->FieldByIndex(nIndex);
	if (pField ==NULL)
		return false;
	if (pField->GetFieldType() == NewFieldType)
		return true;
	CField* pNewField=CreateField(NewFieldType);
	pNewField->CopyCommonProperty(pField);
	Modify(IndexOf(pField),pNewField);
	return true;
}
Ejemplo n.º 5
0
static kbool_t FuelVM_VisitFieldNode(KonohaContext *kctx, KBuilder *builder, kNode *expr, void *thunk)
{
	INode *Node;
	kshort_t index  = (kshort_t)expr->index;
	kshort_t xindex = (kshort_t)(expr->index >> (sizeof(kshort_t)*8));
	enum TypeId Type = ConvertToTypeId(kctx, expr->attrTypeId);
	if((Node = IRBuilder_FindLocalVarByHash(BLD(builder), TYPE_Object, index)) == 0) {
		Node = CreateLocal(BLD(builder), TYPE_Object);
		IField_setHash((IField *) Node, index);
	}
	Node = CreateField(BLD(builder), FieldScope, Type, Node, xindex);
	builder->Value = Node;
	return true;
}
Ejemplo n.º 6
0
void HDialog::_BuildIt(BPositionIO& data)
{
	int kind, cnt;
	BView *contains = fMainView;

	if (gFactor == 0.0)
		gFactor = be_plain_font->Size() / 10.0;

	data >> cnt;
	while (cnt--)
	{
		data >> kind;
		CreateField(kind, data, contains);
	}
} /* HDialog::BuildIt */
Ejemplo n.º 7
0
bool CToolImg::Create(int nBtnWidth, int nBtnHeight, int nMaxCount, COLORREF clrBackground)
{
	// Ensure there is no old handles
	FreeDC();
	FreeBMP();

	if (nBtnWidth <= 0 || nBtnHeight <= 0 || nMaxCount <= 0)
		return false;

	// Init vars
	mn_BtnWidth = nBtnHeight; mn_BtnHeight = nBtnHeight;
	mn_BtnCount = 0; mn_MaxBtnCount = nMaxCount;
	mcr_Background = clrBackground;

	return CreateField(nBtnWidth*nMaxCount, nBtnHeight, clrBackground);
}
void output_ogr(const std::string& filename, const std::string& driver_name, const segvec& removed_segments, const segvec& added_segments) {
    OGRRegisterAll();

    OGRSFDriver* driver = OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName(driver_name.c_str());
    if (!driver) {
        std::cerr << driver_name << " driver not available.\n";
        exit(return_code_fatal);
    }

    //const char* options[] = { "SPATIALITE=yes", "OGR_SQLITE_SYNCHRONOUS=OFF", "INIT_WITH_EPSG=no", nullptr };
    const char* options[] = { nullptr };
    auto data_source = std::unique_ptr<OGRDataSource, OGRDataSourceDestroyer>(driver->CreateDataSource(filename.c_str(), const_cast<char**>(options)));
    if (!data_source) {
        std::cerr << "Creation of output file failed.\n";
        exit(return_code_fatal);
    }

    SRS srs;
    auto layer = data_source->CreateLayer("changes", srs.out(), wkbLineString, const_cast<char**>(options));
    if (!layer) {
        std::cerr << "Creating layer 'changes' failed.\n";
        exit(return_code_fatal);
    }

    OGRFieldDefn field_change("change", OFTInteger);
    field_change.SetWidth(1);
    if (layer->CreateField(&field_change) != OGRERR_NONE ) {
        std::cerr << "Creating field 'change' on 'changes' layer failed.\n";
        exit(return_code_fatal);
    }

    layer->StartTransaction();

    for (const auto& segment : removed_segments) {
        add_segment(layer, 0, segment);
    }

    for (const auto& segment : added_segments) {
        add_segment(layer, 1, segment);
    }

    layer->CommitTransaction();
}
Ejemplo n.º 9
0
static kbool_t FuelVM_VisitFunctionNode(KonohaContext *kctx, KBuilder *builder, kNode *expr, void *thunk)
{
	/*
	 * [FunctionExpr] := new Function(method, env1, env2, ...)
	 * expr->NodeList = [method, defObj, env1, env2, ...]
	 **/
	enum TypeId Type;
	kMethod *mtd = CallNode_getMethod(expr);
	kObject *obj = expr->NodeList->ObjectItems[1];
	INode *MtdObj = CreateObject(BLD(builder), KType_Method, (void *) mtd);

	Type = ConvertToTypeId(kctx, kObject_class(obj)->typeId);
	INode *NewEnv  = CreateNew(BLD(builder), 0, Type);

	size_t i, ParamSize = kArray_size(expr->NodeList)-2;
	for(i = 0; i < ParamSize; i++) {
		kNode *envN = kNode_At(expr, i+2);
		enum TypeId FieldType = ConvertToTypeId(kctx, envN->attrTypeId);
		INode *Node = CreateField(BLD(builder), FieldScope, FieldType, NewEnv, i);
		SUGAR VisitNode(kctx, builder, envN, thunk);
		CreateUpdate(BLD(builder), Node, FuelVM_getExpression(builder));
	}

	Type = ConvertToTypeId(kctx, expr->attrTypeId);
	INode *NewFunc = CreateNew(BLD(builder), 0, Type);

	kNameSpace *ns = kNode_ns(expr);
	mtd =  KLIB kNameSpace_GetMethodByParamSizeNULL(kctx, ns, KClass_Func, KMethodName_("_Create"), 2, KMethodMatch_NoOption);

	INode *CallMtd = CreateObject(BLD(builder), KType_Method, (void *) mtd);
	INode *Params[4];
	Params[0] = CallMtd;
	Params[1] = NewFunc;
	Params[2] = NewEnv;
	Params[3] = MtdObj;
	builder->Value = CreateICall(BLD(builder), Type, DefaultCall, kNode_uline(expr), Params, 4);

	return true;
}
Ejemplo n.º 10
0
CXFA_Node* CXFA_FFWidgetHandler::CreatePushButton(CXFA_Node* pParent,
                                                  CXFA_Node* pBefore) const {
  CXFA_Node* pField = CreateField(XFA_ELEMENT_Button, pParent, pBefore);
  CXFA_Node* pCaption = CreateCopyNode(XFA_ELEMENT_Caption, pField);
  CXFA_Node* pValue = CreateCopyNode(XFA_ELEMENT_Value, pCaption);
  CXFA_Node* pText = CreateCopyNode(XFA_ELEMENT_Text, pValue);
  pText->SetContent(FX_WSTRC(L"Button"), FX_WSTRC(L"Button"), FALSE);
  CXFA_Node* pPara = CreateCopyNode(XFA_ELEMENT_Para, pCaption);
  pPara->SetEnum(XFA_ATTRIBUTE_VAlign, XFA_ATTRIBUTEENUM_Middle, FALSE);
  pPara->SetEnum(XFA_ATTRIBUTE_HAlign, XFA_ATTRIBUTEENUM_Center, FALSE);
  CreateFontNode(pCaption);
  CXFA_Node* pBorder = CreateCopyNode(XFA_ELEMENT_Border, pField);
  pBorder->SetEnum(XFA_ATTRIBUTE_Hand, XFA_ATTRIBUTEENUM_Right, FALSE);
  CXFA_Node* pEdge = CreateCopyNode(XFA_ELEMENT_Edge, pBorder);
  pEdge->SetEnum(XFA_ATTRIBUTE_Stroke, XFA_ATTRIBUTEENUM_Raised, FALSE);
  CXFA_Node* pFill = CreateCopyNode(XFA_ELEMENT_Fill, pBorder);
  CXFA_Node* pColor = CreateCopyNode(XFA_ELEMENT_Color, pFill);
  pColor->SetCData(XFA_ATTRIBUTE_Value, FX_WSTRC(L"212, 208, 200"), FALSE);
  CXFA_Node* pBind = CreateCopyNode(XFA_ELEMENT_Bind, pField);
  pBind->SetEnum(XFA_ATTRIBUTE_Match, XFA_ATTRIBUTEENUM_None);
  return pField;
}
Ejemplo n.º 11
0
// Должна вернуть true, если данные изменились (то есть будет isForce при полной перерисовке)
bool CBackground::PrepareBackground(CVirtualConsole* pVCon, HDC&/*OUT*/ phBgDc, COORD&/*OUT*/ pbgBmpSize)
{
	if (!this)
	{
		_ASSERTE(this!=NULL);
		return false;
	}

	_ASSERTE(isMainThread() && "Must be executed in main thread");

	bool bSucceeded = true;
	bool lbForceUpdate = false;
	LONG lBgWidth = 0, lBgHeight = 0;
	BOOL lbVConImage = FALSE;

	if (gpSet->isBgPluginAllowed)
	{
		if (HasPluginBackgroundImage(&lBgWidth, &lBgHeight)
			&& lBgWidth && lBgHeight)
		{
			lbVConImage = TRUE;
		}
	}

	LONG lMaxBgWidth = 0, lMaxBgHeight = 0;
	bool bIsForeground = gpConEmu->isMeForeground(true);


	// Если плагин свой фон не подсунул
	if (!lbVConImage)
	{
		//if (mp_PluginBg)
		//{
		//	delete mp_PluginBg;
		//	mp_PluginBg = NULL;
		//}

		#ifndef APPDISTINCTBACKGROUND
		// То работаем на общих основаниях, через настройки (или AppDistinct)
		return gpSetCls->PrepareBackground(pVCon, &phBgDc, &pbgBmpSize);
		#else

		CBackgroundInfo* pBgFile = pVCon->GetBackgroundObject();
		if (!pBgFile)
		{
			_ASSERTE(FALSE && "Background object must be created in VCon");
			return false;
		}

		if (!mb_NeedBgUpdate)
		{
			if ((hBgDc == NULL)
				|| (mb_BgLastFade == bIsForeground && gpSet->isFadeInactive)
				|| (!gpSet->isFadeInactive && mb_BgLastFade))
			{
				NeedBackgroundUpdate();
			}
		}

		pBgFile->PollBackgroundFile();

		RECT rcWork = {0, 0, pVCon->GetVConWidth(), pVCon->GetVConHeight()};

		// необходимо проверить размер требуемой картинки
		// -- здесь - всегда только файловая подложка
		if ((gpSet->bgOperation == eUpLeft) || (gpSet->bgOperation == eUpRight)
			|| (gpSet->bgOperation == eDownLeft) || (gpSet->bgOperation == eDownRight)
			|| (gpSet->bgOperation == eCenter))
		{
			// MemoryDC создается всегда по размеру картинки, т.е. изменение размера окна - игнорируется
		}
		else
		{
			// Смотрим дальше
			if (gpSet->bgOperation == eStretch)
			{
				// Строго по размеру клиентской (точнее Workspace) области окна
				lMaxBgWidth = rcWork.right - rcWork.left;
				lMaxBgHeight = rcWork.bottom - rcWork.top;
			}
			else if (gpSet->bgOperation == eFit || gpSet->bgOperation == eFill)
			{
				lMaxBgWidth = rcWork.right - rcWork.left;
				lMaxBgHeight = rcWork.bottom - rcWork.top;
				// Correct aspect ratio
				const BITMAPFILEHEADER* pBgImgData = pBgFile->GetBgImgData();
				const BITMAPINFOHEADER* pBmp = pBgImgData ? (const BITMAPINFOHEADER*)(pBgImgData+1) : NULL;
				if (pBmp
					&& (rcWork.bottom - rcWork.top) > 0 && (rcWork.right - rcWork.left) > 0)
				{
					double ldVCon = (rcWork.right - rcWork.left) / (double)(rcWork.bottom - rcWork.top);
					double ldImg = pBmp->biWidth / (double)pBmp->biHeight;
					if (ldVCon > ldImg)
					{
						if (gpSet->bgOperation == eFit)
							lMaxBgWidth = (LONG)(lMaxBgHeight * ldImg);
						else
							lMaxBgHeight = (LONG)(lMaxBgWidth / ldImg);
					}
					else
					{
						if (gpSet->bgOperation == eFill)
							lMaxBgWidth = (LONG)(lMaxBgHeight * ldImg);
						else
							lMaxBgHeight = (LONG)(lMaxBgWidth / ldImg);
					}
				}
			}
			else if (gpSet->bgOperation == eTile)
			{
				// Max между клиентской (точнее Workspace) областью окна и размером текущего монитора
				// Окно может быть растянуто на несколько мониторов, т.е. размер клиентской области может быть больше
				HMONITOR hMon = MonitorFromWindow(ghWnd, MONITOR_DEFAULTTONEAREST);
				MONITORINFO mon = {sizeof(MONITORINFO)};
				GetMonitorInfo(hMon, &mon);
				//
				lMaxBgWidth = klMax(rcWork.right - rcWork.left,mon.rcMonitor.right - mon.rcMonitor.left);
				lMaxBgHeight = klMax(rcWork.bottom - rcWork.top,mon.rcMonitor.bottom - mon.rcMonitor.top);
			}

			if (bgSize.X != lMaxBgWidth || bgSize.Y != lMaxBgHeight)
				NeedBackgroundUpdate();
		}

		if (mb_NeedBgUpdate)
		{
			mb_NeedBgUpdate = false;
			lbForceUpdate = true;
			_ASSERTE(isMainThread());
			//MSectionLock SBG; SBG.Lock(&mcs_BgImgData);
			//BITMAPFILEHEADER* pImgData = mp_BgImgData;
			BackgroundOp op = (BackgroundOp)gpSet->bgOperation;
			const BITMAPFILEHEADER* pBgImgData = pBgFile->GetBgImgData();
			BOOL lbImageExist = (pBgImgData != NULL);
			//BOOL lbVConImage = FALSE;
			//LONG lBgWidth = 0, lBgHeight = 0;
			//CVirtualConsole* pVCon = gpConEmu->ActiveCon();

			////MSectionLock SBK;
			//if (apVCon && gpSet->isBgPluginAllowed)
			//{
			//	//SBK.Lock(&apVCon->csBkImgData);
			//	if (apVCon->HasBackgroundImage(&lBgWidth, &lBgHeight)
			//	        && lBgWidth && lBgHeight)
			//	{
			//		lbVConImage = lbImageExist = TRUE;
			//	}
			//}

			//mb_WasVConBgImage = lbVConImage;

			if (lbImageExist)
			{
				mb_BgLastFade = (!bIsForeground && gpSet->isFadeInactive);
				TODO("Переделать, ориентироваться только на размер картинки - неправильно");
				TODO("DoubleView - скорректировать X,Y");

				//if (lbVConImage)
				//{
				//	if (lMaxBgWidth && lMaxBgHeight)
				//	{
				//		lBgWidth = lMaxBgWidth;
				//		lBgHeight = lMaxBgHeight;
				//	}

				//	if (!mp_Bg->CreateField(lBgWidth, lBgHeight) ||
				//	        !apVCon->PutBackgroundImage(mp_Bg, 0,0, lBgWidth, lBgHeight))
				//	{
				//		delete mp_Bg;
				//		mp_Bg = NULL;
				//	}
				//}
				//else
				{
					const BITMAPINFOHEADER* pBmp = (const BITMAPINFOHEADER*)(pBgImgData+1);

					if (!lMaxBgWidth || !lMaxBgHeight)
					{
						// Сюда мы можем попасть только в случае eUpLeft/eUpRight/eDownLeft/eDownRight
						lMaxBgWidth = pBmp->biWidth;
						lMaxBgHeight = pBmp->biHeight;
					}

					//LONG lImgX = 0, lImgY = 0, lImgW = lMaxBgWidth, lImgH = lMaxBgHeight;

					//if ((gpSet->bgOperation == eFit || gpSet->bgOperation == eFill)
					//	&& (rcWork.bottom - rcWork.top) > 0 && (rcWork.right - rcWork.left) > 0)
					//{
					//	double ldVCon = (rcWork.right - rcWork.left) / (double)(rcWork.bottom - rcWork.top);
					//	double ldImg = pBmp->biWidth / (double)pBmp->biHeight;
					//	if (ldVCon > ldImg)
					//	{
					//		if (gpSet->bgOperation == eFit)
					//			lMaxBgWidth = lMaxBgHeight * ldImg;
					//		else
					//			lMaxBgHeight = lMaxBgWidth / ldImg;
					//	}
					//	else
					//	{
					//		if (gpSet->bgOperation == eFill)
					//			lMaxBgWidth = lMaxBgHeight * ldImg;
					//		else
					//			lMaxBgHeight = lMaxBgWidth / ldImg;
					//	}
					//}

					if (!CreateField(lMaxBgWidth, lMaxBgHeight) ||
						!FillBackground(pBgImgData, 0,0,lMaxBgWidth,lMaxBgHeight, op, mb_BgLastFade))
					{
						bSucceeded = false;
					}
				}
			}
			else
			{
				bSucceeded = false;
			}
		}

		pBgFile->Release();

		#endif
	}
	else
	{
		if (!mb_NeedBgUpdate)
		{
			if ((mb_BgLastFade == bIsForeground && gpSet->isFadeInactive)
				|| (!gpSet->isFadeInactive && mb_BgLastFade))
			{
				NeedBackgroundUpdate();
			}
		}

		//if (mp_PluginBg == NULL)
		//{
		//	NeedBackgroundUpdate();
		//}

		if (mb_NeedBgUpdate)
		{
			mb_NeedBgUpdate = false;
			lbForceUpdate = true;

			//if (!mp_PluginBg)
			//	mp_PluginBg = new CBackground;

			mb_BgLastFade = (!bIsForeground && gpSet->isFadeInactive);
			TODO("Переделать, ориентироваться только на размер картинки - неправильно");
			TODO("DoubleView - скорректировать X,Y");

			if (lMaxBgWidth && lMaxBgHeight)
			{
				lBgWidth = lMaxBgWidth;
				lBgHeight = lMaxBgHeight;
			}

			if (!CreateField(lBgWidth, lBgHeight) ||
				!PutPluginBackgroundImage(0,0, lBgWidth, lBgHeight))
			{
				//delete mp_PluginBg;
				//mp_PluginBg = NULL;
				bSucceeded = false;
			}
		}

		// Check if the bitmap was prepared for the current Far state
		if ((mp_BkImgData && pVCon)
			// Don't use isFilePanel here because it is `false` when any dialog is active in Panels
			&& ((!(pVCon->isEditor || pVCon->isViewer) && !(mp_BkImgData->dwDrawnPlaces & pbp_Panels))
				|| (pVCon->isEditor && !(mp_BkImgData->dwDrawnPlaces & pbp_Editor))
				|| (pVCon->isViewer && !(mp_BkImgData->dwDrawnPlaces & pbp_Viewer))
			))
		{
			lbForceUpdate = false;
			phBgDc = NULL;
			pbgBmpSize = MakeCoord(0, 0);
			goto wrap;
		}
	}

	if (bSucceeded)
	{
		phBgDc = hBgDc;
		pbgBmpSize = bgSize;
	}
	else
	{
		phBgDc = NULL;
		pbgBmpSize = MakeCoord(0,0);
	}

wrap:
	return lbForceUpdate;
}
Ejemplo n.º 12
0
CXFA_Node* CXFA_FFWidgetHandler::CreateImageField(CXFA_Node* pParent,
                                                  CXFA_Node* pBefore) const {
  CXFA_Node* pField = CreateField(XFA_ELEMENT_ImageEdit, pParent, pBefore);
  return pField;
}
Ejemplo n.º 13
0
void OGRPDFLayer::Fill( GDALPDFArray* poArray )
{
    for(int i=0;i<poArray->GetLength();i++)
    {
        GDALPDFObject* poFeatureObj = poArray->Get(i);
        if (poFeatureObj->GetType() != PDFObjectType_Dictionary)
            continue;

        GDALPDFObject* poA = poFeatureObj->GetDictionary()->Get("A");
        if (!(poA != NULL && poA->GetType() == PDFObjectType_Dictionary))
            continue;

        GDALPDFObject* poP = poA->GetDictionary()->Get("P");
        if (!(poP != NULL && poP->GetType() == PDFObjectType_Array))
            continue;

        GDALPDFObject* poK = poFeatureObj->GetDictionary()->Get("K");
        int nK = -1;
        if (poK != NULL && poK->GetType() == PDFObjectType_Int)
            nK = poK->GetInt();

        GDALPDFArray* poPArray = poP->GetArray();
        int j;
        for(j = 0;j<poPArray->GetLength();j++)
        {
            GDALPDFObject* poKV = poPArray->Get(j);
            if (poKV->GetType() == PDFObjectType_Dictionary)
            {
                GDALPDFObject* poN = poKV->GetDictionary()->Get("N");
                GDALPDFObject* poV = poKV->GetDictionary()->Get("V");
                if (poN != NULL && poN->GetType() == PDFObjectType_String &&
                    poV != NULL)
                {
                    int nIdx = GetLayerDefn()->GetFieldIndex( poN->GetString().c_str() );
                    OGRFieldType eType = OFTString;
                    if (poV->GetType() == PDFObjectType_Int)
                        eType = OFTInteger;
                    else if (poV->GetType() == PDFObjectType_Real)
                        eType = OFTReal;
                    if (nIdx < 0)
                    {
                        OGRFieldDefn oField(poN->GetString().c_str(), eType);
                        CreateField(&oField);
                    }
                    else if (GetLayerDefn()->GetFieldDefn(nIdx)->GetType() != eType &&
                                GetLayerDefn()->GetFieldDefn(nIdx)->GetType() != OFTString)
                    {
                        OGRFieldDefn oField(poN->GetString().c_str(), OFTString);
                        AlterFieldDefn( nIdx, &oField, ALTER_TYPE_FLAG );
                    }
                }
            }
        }

        OGRFeature* poFeature = new OGRFeature(GetLayerDefn());
        for(j = 0;j<poPArray->GetLength();j++)
        {
            GDALPDFObject* poKV = poPArray->Get(j);
            if (poKV->GetType() == PDFObjectType_Dictionary)
            {
                GDALPDFObject* poN = poKV->GetDictionary()->Get("N");
                GDALPDFObject* poV = poKV->GetDictionary()->Get("V");
                if (poN != NULL && poN->GetType() == PDFObjectType_String &&
                    poV != NULL)
                {
                    if (poV->GetType() == PDFObjectType_String)
                        poFeature->SetField(poN->GetString().c_str(), poV->GetString().c_str());
                    else if (poV->GetType() == PDFObjectType_Int)
                        poFeature->SetField(poN->GetString().c_str(), poV->GetInt());
                    else if (poV->GetType() == PDFObjectType_Real)
                        poFeature->SetField(poN->GetString().c_str(), poV->GetReal());
                }
            }
        }

        if (nK >= 0)
        {
            OGRGeometry* poGeom = poDS->GetGeometryFromMCID(nK);
            if (poGeom)
            {
                poGeom->assignSpatialReference(GetSpatialRef());
                poFeature->SetGeometry(poGeom);
            }
        }

        OGRGeometry* poGeom = poFeature->GetGeometryRef();
        if( !bGeomTypeMixed && poGeom != NULL )
        {
            if (!bGeomTypeSet)
            {
                bGeomTypeSet = TRUE;
                GetLayerDefn()->SetGeomType(poGeom->getGeometryType());
            }
            else if (GetLayerDefn()->GetGeomType() != poGeom->getGeometryType())
            {
                bGeomTypeMixed = TRUE;
                GetLayerDefn()->SetGeomType(wkbUnknown);
            }
        }
        ICreateFeature(poFeature);

        delete poFeature;
    }
}
Ejemplo n.º 14
0
CXFA_Node* CXFA_FFWidgetHandler::CreateDropdownList(CXFA_Node* pParent,
                                                    CXFA_Node* pBefore) const {
  CXFA_Node* pField = CreateField(XFA_ELEMENT_ChoiceList, pParent, pBefore);
  return pField;
}
Ejemplo n.º 15
0
CXFA_Node* CXFA_FFWidgetHandler::CreateSignature(CXFA_Node* pParent,
                                                 CXFA_Node* pBefore) const {
  CXFA_Node* pField = CreateField(XFA_ELEMENT_Signature, pParent, pBefore);
  return pField;
}
Ejemplo n.º 16
0
CXFA_Node* CXFA_FFWidgetHandler::CreateDatetimeEdit(CXFA_Node* pParent,
                                                    CXFA_Node* pBefore) const {
  CXFA_Node* pField = CreateField(XFA_ELEMENT_DateTimeEdit, pParent, pBefore);
  CreateValueNode(XFA_ELEMENT_Date, pField);
  return pField;
}
Ejemplo n.º 17
0
bool CToolImg::CreateButtonField(COLORREF clrBackground, ButtonFieldInfo* pBtns, int nBtnCount)
{
	FreeDC();
	FreeBMP();

	mprc_Btns = (LPRECT)calloc(nBtnCount, sizeof(*mprc_Btns));
	if (!mprc_Btns)
		return false;
	mn_MaxBtnCount = nBtnCount;

	int nFieldWidth = pBtns[0].nWidth;
	int nFieldHeight = pBtns[0].nHeight;
	for (int i = 1; i < nBtnCount; i++)
	{
		nFieldWidth = std::max(nFieldWidth, pBtns[i].nWidth);
		nFieldHeight += 1 + pBtns[i].nHeight;
	}

	if (!CreateField(nFieldWidth, nFieldHeight, clrBackground))
		return false;

	//COLORMAP colorMap = {0xC0C0C0, clrBackground/*GetSysColor(COLOR_BTNFACE)*/};

	bool bRc = true;

	_ASSERTE(mn_BtnCount == 0);

	int nDstY = 0;
	DWORD nErrCode = 0;

	for (int i = 0; i < nBtnCount; i++)
	{
		//HBITMAP hbm = CreateMappedBitmap(g_hInstance, (INT_PTR)pBtns[i].szName, 0, &colorMap, 1);
		HBITMAP hbm = (HBITMAP)LoadImage(g_hInstance, pBtns[i].szName, IMAGE_BITMAP, 0, 0, LR_LOADTRANSPARENT|LR_LOADMAP3DCOLORS);
		if (hbm == NULL)
		{
			nErrCode = GetLastError();
			bRc = false;
			continue;
		}
		else
		{
			RECT rc = {0, nDstY, pBtns[i].nWidth, nDstY+pBtns[i].nHeight};
			mprc_Btns[i] = rc;

			if (!PaintBitmap(hbm, pBtns[i].nWidth, pBtns[i].nHeight, mh_BmpDc, 0, nDstY, pBtns[i].nWidth, pBtns[i].nHeight))
			{
				nErrCode = GetLastError();
				bRc = false;
			}

			DeleteObject(hbm);
		}

		nDstY += 1 + pBtns[i].nHeight;
	}

	#ifdef _DEBUG
	//SaveImageEx(L"T:\\BtnField.png", mh_Bmp);
	#endif

	mn_BtnCount = mn_MaxBtnCount;

	return true;
}
Ejemplo n.º 18
0
CXFA_Node* CXFA_FFWidgetHandler::CreateCheckButton(CXFA_Node* pParent,
                                                   CXFA_Node* pBefore) const {
  CXFA_Node* pField = CreateField(XFA_ELEMENT_CheckButton, pParent, pBefore);
  return pField;
}