static int LoadCTB(char *name) { CTB_handle ctbhan; uchar CTBdata[CTB_DATA_SIZE]; welet *wel, *twel; int num; int i; int16_t *pint16; uint32_t *pword32; // process CTB-file if (CTB_open(name, &ctbhan, "r") == FALSE) { // MessageBox(GetActiveWindow(),name,"Error open CTB-base",MB_OK); return -41; } // grey file ? if ((ctbhan.signums & CTB_GRAY) == 0) { CTB_close(&ctbhan); // MessageBox(GetActiveWindow(),name,"Not grey base",MB_OK); return -42; } if (CTB_read_global_data(&ctbhan, CTBdata) == 0 || memcmp(&CTBdata[1], ParolBase, 5) != 0) { CTB_close(&ctbhan); // MessageBox(GetActiveWindow(),name,"Not cluster CTB-base",MB_OK); return -43; } num = CTB_volume(&ctbhan); if ((wel = (welet *) malloc(num * sizeof(welet))) == NULL) { CTB_close(&ctbhan); return -1; } for (i = 0, twel = wel; i < num; i++, twel++) { if (GetCTBasWelet(&ctbhan, i, twel) == 0) { CTB_close(&ctbhan); return -2; } } CTB_close(&ctbhan); // now to static memset(&fonbase, 0, sizeof(FONBASE)); pint16 = (int16_t *) (CTBdata + 6); pword32 = (uint32_t *) (CTBdata + 8); fonbase.start = wel; fonbase.inBase = num; fonbase.ace = NULL; fonbase.countFont = *pint16; // Информация о шрифтах в полях SetFields(fonbase.fontFields[0],pword32); SetFields(fonbase.fontFields[1],(pword32+2)); SetFields(fonbase.fontFields[2],(pword32+4)); SetFields(fonbase.fontFields[3],(pword32+6)); return num; }
void CDlgCentroid::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); DDX_Control(pDX, IDC_RADIO3, m_button_default); DDX_Control(pDX, IDC_RADIO2, m_button_set); DDX_Control(pDX, IDC_COMBO1, m_combo_units); DDX_Control(pDX, IDC_EDIT1, m_edit_x); DDX_Control(pDX, IDC_EDIT2, m_edit_y); DDX_Control(pDX, IDC_COMBO_ANGLE, m_combo_angle); if( !pDX->m_bSaveAndValidate ) { // incoming m_combo_units.InsertString( 0, "MIL" ); m_combo_units.InsertString( 1, "MM" ); m_combo_angle.InsertString( 0, "0" ); m_combo_angle.InsertString( 1, "90" ); m_combo_angle.InsertString( 2, "180" ); m_combo_angle.InsertString( 3, "270" ); SetFields(); } else { // outgoing GetFields(); } }
void DlgDRC::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); DDX_Control(pDX, IDC_COMBO1, m_combo_units); DDX_Control(pDX, IDC_EDIT1, m_edit_pad_pad); DDX_Control(pDX, IDC_EDIT7, m_edit_pad_trace); DDX_Control(pDX, IDC_EDIT6, m_edit_trace_trace); DDX_Control(pDX, IDC_EDIT5, m_edit_hole_copper); DDX_Control(pDX, IDC_EDIT4, m_edit_annular_ring_pins); DDX_Control(pDX, IDC_EDIT2, m_edit_board_edge_copper); DDX_Control(pDX, IDC_EDIT8, m_edit_hole_hole); DDX_Control(pDX, IDC_EDIT9, m_edit_annular_ring_vias); DDX_Control(pDX, IDC_EDIT10, m_edit_copper_copper); DDX_Control(pDX, IDC_EDIT14, m_edit_trace_width); DDX_Control(pDX, IDC_EDIT11, m_edit_board_edge_hole); DDX_Control(pDX, IDC_CHECK_SHOW_UNROUTED, m_check_show_unrouted); if( !pDX->m_bSaveAndValidate ) { // incoming m_combo_units.InsertString( 0, "MIL" ); m_combo_units.InsertString( 1, "MM" ); if( m_units == MIL ) m_combo_units.SetCurSel( 0 ); else m_combo_units.SetCurSel( 1 ); SetFields(); } }
OGRFeature *TigerAltName::GetFeature( int nRecordId ) { char achRecord[OGR_TIGER_RECBUF_LEN]; if( nRecordId < 0 || nRecordId >= nFeatures ) { CPLError( CE_Failure, CPLE_FileIO, "Request for out-of-range feature %d of %s4", nRecordId, pszModule ); return NULL; } /* -------------------------------------------------------------------- */ /* Read the raw record data from the file. */ /* -------------------------------------------------------------------- */ if( fpPrimary == NULL ) return NULL; if( VSIFSeekL( fpPrimary, nRecordId * nRecordLength, SEEK_SET ) != 0 ) { CPLError( CE_Failure, CPLE_FileIO, "Failed to seek to %d of %s4", nRecordId * nRecordLength, pszModule ); return NULL; } if( VSIFReadL( achRecord, psRTInfo->nRecordLength, 1, fpPrimary ) != 1 ) { CPLError( CE_Failure, CPLE_FileIO, "Failed to read record %d of %s4", nRecordId, pszModule ); return NULL; } /* -------------------------------------------------------------------- */ /* Set fields. */ /* -------------------------------------------------------------------- */ OGRFeature *poFeature = new OGRFeature( poFeatureDefn ); int anFeatList[5]; int nFeatCount=0; SetFields( psRTInfo, poFeature, achRecord ); for( int iFeat = 0; iFeat < 5; iFeat++ ) { const char * pszFieldText; pszFieldText = GetField( achRecord, 19 + iFeat*8, 26 + iFeat*8 ); if( *pszFieldText != '\0' ) anFeatList[nFeatCount++] = atoi(pszFieldText); } poFeature->SetField( "FEAT", nFeatCount, anFeatList ); return poFeature; }
void CDlgRefText::OnCbnSelchangeComboRefTextUnits() { GetFields(); if( m_combo_units.GetCurSel() == 0 ) m_units = MIL; else m_units = MM; SetFields(); }
void MovieSeconds::Set(const Fields &numFields, eVideoRate theVideoRate, tc_mode tcMode) { fVideoRate = theVideoRate; fFieldDuration = VideoRateToFieldDuration(theVideoRate); fInitialized = true; SetFields(numFields); fTCMode = tcMode; }
OGRFeature *TigerPoint::GetFeature( int nRecordId, int nX0, int nX1, int nY0, int nY1 ) { char achRecord[OGR_TIGER_RECBUF_LEN]; if( nRecordId < 0 || nRecordId >= nFeatures ) { CPLError( CE_Failure, CPLE_FileIO, "Request for out-of-range feature %d of %sP", nRecordId, pszModule ); return nullptr; } /* -------------------------------------------------------------------- */ /* Read the raw record data from the file. */ /* -------------------------------------------------------------------- */ if( fpPrimary == nullptr ) return nullptr; if( VSIFSeekL( fpPrimary, nRecordId * nRecordLength, SEEK_SET ) != 0 ) { CPLError( CE_Failure, CPLE_FileIO, "Failed to seek to %d of %sP", nRecordId * nRecordLength, pszModule ); return nullptr; } // Overflow cannot happen since psRTInfo->nRecordLength is unsigned // char and sizeof(achRecord) == OGR_TIGER_RECBUF_LEN > 255 if( VSIFReadL( achRecord, psRTInfo->nRecordLength, 1, fpPrimary ) != 1 ) { CPLError( CE_Failure, CPLE_FileIO, "Failed to read record %d of %sP", nRecordId, pszModule ); return nullptr; } /* -------------------------------------------------------------------- */ /* Set fields. */ /* -------------------------------------------------------------------- */ OGRFeature *poFeature = new OGRFeature( poFeatureDefn ); SetFields( psRTInfo, poFeature, achRecord); /* -------------------------------------------------------------------- */ /* Set geometry */ /* -------------------------------------------------------------------- */ const double dfX = atoi(GetField(achRecord, nX0, nX1)) / 1000000.0; const double dfY = atoi(GetField(achRecord, nY0, nY1)) / 1000000.0; if( dfX != 0.0 || dfY != 0.0 ) { poFeature->SetGeometryDirectly( new OGRPoint( dfX, dfY ) ); } return poFeature; }
void DlgEditBoardCorner::OnCbnSelchangeComboCornerUnits() { GetFields(); if( m_combo_units.GetCurSel() == 0 ) m_units = MIL; else m_units = MM; SetFields(); }
void CDlgCentroid::OnCbnSelChangeCombo1() { GetFields(); int m_sel_units = m_combo_units.GetCurSel(); if( m_sel_units == 0 ) m_units = MIL; else m_units = MM; SetFields(); }
void DlgDRC::OnCbnChangeUnits() { CString str; m_combo_units.GetWindowText( str ); GetFields(); if( str == "MIL" ) m_units = MIL; else m_units = MM; SetFields(); }
OGRFeature *TigerFileBase::GetFeature( int nRecordId ) { char achRecord[OGR_TIGER_RECBUF_LEN]; if (psRTInfo == NULL) return NULL; if( nRecordId < 0 || nRecordId >= nFeatures ) { CPLError( CE_Failure, CPLE_FileIO, "Request for out-of-range feature %d of %s", nRecordId, pszModule ); return NULL; } /* -------------------------------------------------------------------- */ /* Read the raw record data from the file. */ /* -------------------------------------------------------------------- */ if( fpPrimary == NULL ) return NULL; if( VSIFSeekL( fpPrimary, nRecordId * nRecordLength, SEEK_SET ) != 0 ) { CPLError( CE_Failure, CPLE_FileIO, "Failed to seek to %d of %s", nRecordId * nRecordLength, pszModule ); return NULL; } if( VSIFReadL( achRecord, psRTInfo->nRecordLength, 1, fpPrimary ) != 1 ) { CPLError( CE_Failure, CPLE_FileIO, "Failed to read record %d of %s", nRecordId, pszModule ); return NULL; } /* -------------------------------------------------------------------- */ /* Set fields. */ /* -------------------------------------------------------------------- */ OGRFeature *poFeature = new OGRFeature( poFeatureDefn ); SetFields( psRTInfo, poFeature, achRecord ); return poFeature; }
void CDlgRefText::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); DDX_Control(pDX, IDC_EDIT_REF_ID, m_edit_ref_des); DDX_Control(pDX, IDC_EDIT_CHAR_HEIGHT, m_edit_height); DDX_Control(pDX, IDC_COMBO_REF_TEXT_UNITS, m_combo_units); DDX_Control(pDX, IDC_RADIO_SET, m_radio_set); DDX_Control(pDX, IDC_RADIO_DEF, m_radio_def); DDX_Control(pDX, IDC_EDIT_WIDTH, m_edit_width); DDX_Control(pDX, IDC_EDIT_DEF_WIDTH, m_edit_def_width); DDX_Control(pDX, IDC_CHECK_VISIBLE, m_check_visible); if( !pDX->m_bSaveAndValidate ) { // entry m_edit_ref_des.EnableWindow( FALSE ); m_edit_ref_des.SetWindowText( m_part->ref_des ); m_combo_units.InsertString( 0, "MIL" ); m_combo_units.InsertString( 1, "MM" ); if( m_units == MIL ) m_combo_units.SetCurSel( 0 ); else m_combo_units.SetCurSel( 1 ); if( m_width == m_height/10 ) { m_radio_set.SetCheck( FALSE ); m_radio_def.SetCheck( TRUE ); m_edit_def_width.EnableWindow( FALSE ); m_edit_width.EnableWindow( FALSE ); } else { m_radio_set.SetCheck( TRUE ); m_radio_def.SetCheck( FALSE ); m_edit_def_width.EnableWindow( FALSE ); m_edit_width.EnableWindow( TRUE ); } SetFields(); } else { // exit GetFields(); if( m_radio_def.GetCheck() ) m_width = m_def_width; } }
////////////////// /////////////////////// // return == 0 - error static int GetCTBasWelet(CTB_handle *CTBhandle, int num, welet *wel) { uchar CTBdata[CTB_DATA_SIZE]; uint16_t *pword16; int16_t *pint16; uint32_t *pword32; if (CTB_read(CTBhandle, num, wel->raster, CTBdata) == FALSE) return 0; wel->let = CTBdata[3]; // in ASCII wel->w = CTBdata[4]; wel->h = CTBdata[5]; wel->weight = CTBdata[6]; // how many symbols make wel->porog = CTBdata[7]; // threshold wel->mw = CTBdata[8]; // medium width wel->mh = CTBdata[9]; // height wel->prob = CTBdata[10]; // for CTB - probability wel->attr = CTBdata[11]; // now put words pword16 = (uint16_t *) (CTBdata + 12); wel->fill = pword16[0]; wel->num = pword16[1]; wel->invalid = pword16[2]; wel->valid = CTBdata[18]; // for CTB - validity wel->kegl = CTBdata[19]; // now short int's pint16 = (int16_t *) (CTBdata + 20); wel->sr_col = pint16[0]; wel->sr_row = pint16[1]; // now dword pword32 = (uint32_t *) (CTBdata + 24); wel->summa = pword32[0]; SetFields(wel->fields,(pword32+1)); pint16 = (int16_t *) (CTBdata + 28 + NFIELDDWORD * sizeof(uint32_t)); wel->nInCTB = pint16[0]; pword32 = (uint32_t *) (pint16 + 1); wel->tablColumn = pword32[0]; return 1; }
GQuery* GetFeatureRequest::ParseKvpQuery(FeatureClass* pFeatureClass)//;const char* filter, const char* fields, const char* typeName, Map* pMap) { XParser parser; XDocument* pxDoc = NULL; GFilter *pFilter = NULL; FilterReader* reader = NULL; FilterFactory *factory = augeGetFilterFactoryInstance(); GQuery* pQuery = factory->CreateQuery(); if(pQuery==NULL) { return NULL; } pQuery = factory->CreateQuery(); if(m_extent.IsValid()) { GField* pField = pFeatureClass->GetFields()->GetGeometryField(); if(pField) { pFilter = factory->CreateBBoxFilter(pField->GetName(), m_extent); pQuery->SetFilter(pFilter); } } else { pxDoc = parser.ParseMemory(m_filter); if(pxDoc!=NULL) { reader = factory->CreateFilerReader(pFeatureClass->GetFields()); pFilter = reader->Read(pxDoc->GetRootNode()); pQuery->SetFilter(pFilter); pxDoc->Release(); } } pQuery->SetMaxFeatures(m_max_features); pQuery->SetOffset(m_offset); SetFields(pQuery, m_fields); return pQuery; }
void uType::SetFields(size_t inherited, uType* type, uintptr_t offset, int flags, ...) { SetFields(inherited); Fields[inherited].Type = U_ASSERT_PTR(type); Fields[inherited].Offset = offset; Fields[inherited].Flags = (uint8_t)flags; va_list ap; va_start(ap, flags); for (size_t i = inherited + 1; i < FieldCount; i++) { Fields[i].Type = U_ASSERT_PTR(va_arg(ap, uType*)); Fields[i].Offset = va_arg(ap, uintptr_t); Fields[i].Flags = (uint8_t)va_arg(ap, int); } va_end(ap); }
void DlgEditBoardCorner::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); DDX_Control(pDX, IDC_COMBO_CORNER_UNITS, m_combo_units); DDX_Control(pDX, IDC_EDIT_X, m_edit_x); DDX_Control(pDX, IDC_EDIT_Y, m_edit_y); if( !pDX->m_bSaveAndValidate && m_title_str ) { // incoming SetWindowText( *m_title_str ); m_combo_units.InsertString( 0, "MIL" ); m_combo_units.InsertString( 1, "MM" ); if( m_units == MIL ) m_combo_units.SetCurSel(0); else m_combo_units.SetCurSel(1); SetFields(); } else { // outgoing GetFields(); } }
OGRFeature *TigerCompleteChain::GetFeature( int nRecordId ) { char achRecord[OGR_TIGER_RECBUF_LEN]; if( nRecordId < 0 || nRecordId >= nFeatures ) { CPLError( CE_Failure, CPLE_FileIO, "Request for out-of-range feature %d of %s1", nRecordId, pszModule ); return NULL; } /* -------------------------------------------------------------------- */ /* Read the raw record data from the file. */ /* -------------------------------------------------------------------- */ if( fpPrimary == NULL ) return NULL; if( VSIFSeekL( fpPrimary, (nRecordId+nRT1RecOffset) * nRecordLength, SEEK_SET ) != 0 ) { CPLError( CE_Failure, CPLE_FileIO, "Failed to seek to %d of %s1", nRecordId * nRecordLength, pszModule ); return NULL; } if( VSIFReadL( achRecord, psRT1Info->nRecordLength, 1, fpPrimary ) != 1 ) { CPLError( CE_Failure, CPLE_FileIO, "Failed to read %d bytes of record %d of %s1 at offset %d", psRT1Info->nRecordLength, nRecordId, pszModule, (nRecordId+nRT1RecOffset) * nRecordLength ); return NULL; } /* -------------------------------------------------------------------- */ /* Set fields. */ /* -------------------------------------------------------------------- */ OGRFeature *poFeature = new OGRFeature( poFeatureDefn ); SetFields( psRT1Info, poFeature, achRecord ); /* -------------------------------------------------------------------- */ /* Read RT3 record, and apply fields. */ /* -------------------------------------------------------------------- */ if( fpRT3 != NULL ) { char achRT3Rec[OGR_TIGER_RECBUF_LEN]; int nRT3RecLen = psRT3Info->nRecordLength + nRecordLength - psRT1Info->nRecordLength; if( VSIFSeekL( fpRT3, nRecordId * nRT3RecLen, SEEK_SET ) != 0 ) { CPLError( CE_Failure, CPLE_FileIO, "Failed to seek to %d of %s3", nRecordId * nRT3RecLen, pszModule ); return NULL; } if( VSIFReadL( achRT3Rec, psRT3Info->nRecordLength, 1, fpRT3 ) != 1 ) { CPLError( CE_Failure, CPLE_FileIO, "Failed to read record %d of %s3", nRecordId, pszModule ); return NULL; } SetFields( psRT3Info, poFeature, achRT3Rec ); } /* -------------------------------------------------------------------- */ /* Set geometry */ /* -------------------------------------------------------------------- */ OGRLineString *poLine = new OGRLineString(); poLine->setPoint(0, atoi(GetField(achRecord, 191, 200)) / 1000000.0, atoi(GetField(achRecord, 201, 209)) / 1000000.0 ); if( !AddShapePoints( poFeature->GetFieldAsInteger("TLID"), nRecordId, poLine, 0 ) ) { delete poFeature; return NULL; } poLine->addPoint(atoi(GetField(achRecord, 210, 219)) / 1000000.0, atoi(GetField(achRecord, 220, 228)) / 1000000.0 ); poFeature->SetGeometryDirectly( poLine ); return poFeature; }
OGRFeature *TigerPolygon::GetFeature( int nRecordId ) { char achRecord[OGR_TIGER_RECBUF_LEN]; if( nRecordId < 0 || nRecordId >= nFeatures ) { CPLError( CE_Failure, CPLE_FileIO, "Request for out-of-range feature %d of %sA", nRecordId, pszModule ); return NULL; } /* -------------------------------------------------------------------- */ /* Read the raw record data from the file. */ /* -------------------------------------------------------------------- */ if( fpPrimary == NULL ) return NULL; if( VSIFSeek( fpPrimary, nRecordId * nRecordLength, SEEK_SET ) != 0 ) { CPLError( CE_Failure, CPLE_FileIO, "Failed to seek to %d of %sA", nRecordId * nRecordLength, pszModule ); return NULL; } if( VSIFRead( achRecord, nRecordLength, 1, fpPrimary ) != 1 ) { CPLError( CE_Failure, CPLE_FileIO, "Failed to read record %d of %sA", nRecordId, pszModule ); return NULL; } /* -------------------------------------------------------------------- */ /* Set fields. */ /* -------------------------------------------------------------------- */ OGRFeature *poFeature = new OGRFeature( poFeatureDefn ); SetFields( psRTAInfo, poFeature, achRecord ); /* -------------------------------------------------------------------- */ /* Read RTS record, and apply fields. */ /* -------------------------------------------------------------------- */ if( fpRTS != NULL ) { char achRTSRec[OGR_TIGER_RECBUF_LEN]; if( VSIFSeek( fpRTS, nRecordId * nRTSRecLen, SEEK_SET ) != 0 ) { CPLError( CE_Failure, CPLE_FileIO, "Failed to seek to %d of %sS", nRecordId * nRTSRecLen, pszModule ); return NULL; } if( VSIFRead( achRTSRec, psRTSInfo->nRecordLength, 1, fpRTS ) != 1 ) { CPLError( CE_Failure, CPLE_FileIO, "Failed to read record %d of %sS", nRecordId, pszModule ); return NULL; } SetFields( psRTSInfo, poFeature, achRTSRec ); } return poFeature; }
void CDlgCentroid::OnBnClickedSet() { m_button_default.SetCheck(0); GetFields(); SetFields(); }