void QgsDualView::init( QgsVectorLayer* layer, QgsMapCanvas* mapCanvas, const QgsFeatureRequest &request, QgsAttributeEditorContext context ) { mEditorContext = context; connect( mTableView, SIGNAL( willShowContextMenu( QMenu*, QModelIndex ) ), this, SLOT( viewWillShowContextMenu( QMenu*, QModelIndex ) ) ); initLayerCache( layer ); initModels( mapCanvas, request ); mTableView->setModel( mFilterModel ); mFeatureList->setModel( mFeatureListModel ); mAttributeForm = new QgsAttributeForm( layer, QgsFeature(), mEditorContext ); mAttributeEditorScrollArea->setLayout( new QGridLayout() ); mAttributeEditorScrollArea->layout()->addWidget( mAttributeForm ); mAttributeEditorScrollArea->setWidget( mAttributeForm ); mAttributeForm->hideButtonBox(); connect( mAttributeForm, SIGNAL( attributeChanged( QString, QVariant ) ), this, SLOT( featureFormAttributeChanged() ) ); if ( mFeatureListPreviewButton->defaultAction() ) mFeatureList->setDisplayExpression( mDisplayExpression ); else columnBoxInit(); mFeatureList->setEditSelection( QgsFeatureIds() << mFeatureListModel->idxToFid( mFeatureListModel->index( 0, 0 ) ) ); }
/** * loadPatterns * Loads the patterns from the directory specified in * the environment variable MERLIN_HOME or in if not set * in the current directory **/ void loadPatterns() { char name[MAX_PATH], *ptr; DIR *dir; struct dirent *entry; char *patdir = getenv( "MERLIN_HOME" ); BANK cb; if ( models[0] != NULL || models[1] != NULL || models[2] != NULL) freeModels(); if ( initModels() ) { fprintf( stderr, "Could not alloc mem for patterns\n" ); return; } if ( patdir == NULL ) patdir = DEFAULT_HOME; dir = opendir(patdir); if ( dir == NULL ) { fprintf( stderr, "Could not open %s. No characters loaded\n", patdir ); return; } while ( (entry = readdir( dir )) != NULL ) { sprintf( name, "%s/%s", patdir, entry->d_name ); if ( strstr( entry->d_name, "natural" ) != NULL ) cb = NATURAL; else if ( strstr( entry->d_name, "numeral" ) != NULL ) cb = NUMERAL; else cb = EXTENDED; ptr = name + strlen( name ) - 4; if ( ptr > name && strcmp( ptr, ".dat" ) == 0 ) { models[cb][npatterns[cb]] = loadPattern( name ); if ( models[cb][npatterns[cb]] == NULL ) { fprintf( stderr, "Warning. Could not load pattern: %s\n", name ); continue; } npatterns[cb]++; if ( npatterns[cb] == MAX_PATTERNS ) { fprintf( stderr, "Warning. There are %d patterns or more in " " %s. Only %d loaded.\n", MAX_PATTERNS, patdir, MAX_PATTERNS ); break; } } } closedir( dir ); }
FrmTrip::FrmTrip(RoleDef* inRoleDef, Sample* inSample, DateModel* inTDateTime, RuleChecker* ruleCheckerPtr, QWidget *parent, Qt::WFlags flags): PreviewTab(5,inRoleDef,inSample,inTDateTime,tr("Fishing Trip"), ruleCheckerPtr, parent, flags){ setupUi(this); blockCustomDateCtrls(); installEventFilters(); connect(pushNext, SIGNAL(clicked()), this, SLOT(next())); connect(pushPrevious, SIGNAL(clicked()), this, SLOT(goBack())); connect(this, SIGNAL(blockCatchUISignals(const bool)), catchInputCtrl, SIGNAL(blockWidgetsSignals(const bool))); tTrips=0; tRefGears=0; tTripGears=0; tRefZones=0; tTripZones=0; viewTrips=0; mapper1=0; multiModelI=0; multiModelI2=0; mapperStartDt=0; mapperEndDt=0; nullDelegate=0; initModels(); initUI(); initMappers(); }
void QgsDualView::init( QgsVectorLayer* layer, QgsMapCanvas* mapCanvas, const QgsFeatureRequest &request, const QgsAttributeEditorContext &context ) { mEditorContext = context; connect( mTableView, SIGNAL( willShowContextMenu( QMenu*, QModelIndex ) ), this, SLOT( viewWillShowContextMenu( QMenu*, QModelIndex ) ) ); initLayerCache( layer, !request.filterRect().isNull() ); initModels( mapCanvas, request ); mConditionalFormatWidget->setLayer( layer ); mTableView->setModel( mFilterModel ); mFeatureList->setModel( mFeatureListModel ); mAttributeForm = new QgsAttributeForm( layer, QgsFeature(), mEditorContext ); if ( !mAttributeEditorScrollArea->layout() ) mAttributeEditorScrollArea->setLayout( new QGridLayout() ); mAttributeEditorScrollArea->layout()->addWidget( mAttributeForm ); mAttributeEditorScrollArea->setWidget( mAttributeForm ); mAttributeForm->hideButtonBox(); connect( mAttributeForm, SIGNAL( attributeChanged( QString, QVariant ) ), this, SLOT( featureFormAttributeChanged() ) ); connect( mMasterModel, SIGNAL( modelChanged() ), mAttributeForm, SLOT( refreshFeature() ) ); if ( mFeatureListPreviewButton->defaultAction() ) mFeatureList->setDisplayExpression( mDisplayExpression ); else columnBoxInit(); // This slows down load of the attribute table heaps and uses loads of memory. //mTableView->resizeColumnsToContents(); mFeatureList->setEditSelection( QgsFeatureIds() << mFeatureListModel->idxToFid( mFeatureListModel->index( 0, 0 ) ) ); }
FrmCell::FrmCell(RoleDef* inRoleDef, Sample* inSample, RuleChecker* ruleCheckerPtr, QWidget *parent, Qt::WFlags flags): PreviewTab(2, inRoleDef,inSample,tr("Cell"), ruleCheckerPtr, parent, flags){ setupUi(this); installEventFilters(); connect(pushNext, SIGNAL(clicked()), this, SLOT(next())); connect(pushPrevious, SIGNAL(clicked()), this, SLOT(goBack())); connect(toolButton, SIGNAL(clicked()), this, SLOT(onShowFrameDetails())); connect(this, SIGNAL(hideFrameDetails(bool)), this, SLOT(onHideFrameDetails())); tSampCell=0; viewCell=0; mapper1=0; initModels(); initUI(); }
FrmMinorStrata::FrmMinorStrata(RoleDef* inRoleDef, Sample* inSample, RuleChecker* ruleCheckerPtr, QWidget *parent, Qt::WFlags flags): PreviewTab(1, inRoleDef, inSample,tr("Stratum"), ruleCheckerPtr, parent, flags){ setupUi(this); installEventFilters(); viewMinorStrata=0; tRefMinorStrata=0; buttonGroup=0; mapper1=0; connect(pushNext, SIGNAL(clicked()), this, SLOT(next())); connect(pushPrevious, SIGNAL(clicked()), this, SLOT(goBack())); connect(toolButton, SIGNAL(clicked()), this, SLOT(onShowFrameDetails())); connect(this, SIGNAL(hideFrameDetails(bool)), this, SLOT(onHideFrameDetails())); initModels(); initUI(); initMappers(); }
void QgsDualView::init( QgsVectorLayer *layer, QgsMapCanvas *mapCanvas, const QgsFeatureRequest &request, const QgsAttributeEditorContext &context, bool loadFeatures ) { if ( !layer ) return; mLayer = layer; mEditorContext = context; connect( mTableView, &QgsAttributeTableView::willShowContextMenu, this, &QgsDualView::viewWillShowContextMenu ); mTableView->horizontalHeader()->setContextMenuPolicy( Qt::CustomContextMenu ); connect( mTableView->horizontalHeader(), &QHeaderView::customContextMenuRequested, this, &QgsDualView::showViewHeaderMenu ); connect( mTableView, &QgsAttributeTableView::columnResized, this, &QgsDualView::tableColumnResized ); connect( mFeatureList, &QgsFeatureListView::willShowContextMenu, this, &QgsDualView::widgetWillShowContextMenu ); initLayerCache( !( request.flags() & QgsFeatureRequest::NoGeometry ) || !request.filterRect().isNull() ); initModels( mapCanvas, request, loadFeatures ); mConditionalFormatWidget->setLayer( mLayer ); mTableView->setModel( mFilterModel ); mFeatureList->setModel( mFeatureListModel ); delete mAttributeForm; mAttributeForm = new QgsAttributeForm( mLayer, mTempAttributeFormFeature, mEditorContext ); mTempAttributeFormFeature = QgsFeature(); if ( !context.parentContext() ) { mAttributeEditorScrollArea = new QgsScrollArea(); mAttributeEditorScrollArea->setWidgetResizable( true ); mAttributeEditor->layout()->addWidget( mAttributeEditorScrollArea ); mAttributeEditorScrollArea->setWidget( mAttributeForm ); } else { mAttributeEditor->layout()->addWidget( mAttributeForm ); } connect( mAttributeForm, &QgsAttributeForm::widgetValueChanged, this, &QgsDualView::featureFormAttributeChanged ); connect( mAttributeForm, &QgsAttributeForm::modeChanged, this, &QgsDualView::formModeChanged ); connect( mMasterModel, &QgsAttributeTableModel::modelChanged, mAttributeForm, &QgsAttributeForm::refreshFeature ); connect( mAttributeForm, &QgsAttributeForm::filterExpressionSet, this, &QgsDualView::filterExpressionSet ); connect( mFilterModel, &QgsAttributeTableFilterModel::sortColumnChanged, this, &QgsDualView::onSortColumnChanged ); if ( mFeatureListPreviewButton->defaultAction() ) mFeatureList->setDisplayExpression( mDisplayExpression ); else columnBoxInit(); // This slows down load of the attribute table heaps and uses loads of memory. //mTableView->resizeColumnsToContents(); mFeatureList->setEditSelection( QgsFeatureIds() << mFeatureListModel->idxToFid( mFeatureListModel->index( 0, 0 ) ) ); }
void GameScene::Init() { initModels(); //init skybox skybox.Setup(); //load textures graphics::TextureManager::LoadTextures(); //create vbos graphics::VertexBufferManager::CreateBuffers(); }
/*------------------------------------------------------*/ int getAndMoveToFrontDecode(unsigned limit) { char yy[256]; int32_t i, tmpOrigPtr; tmpOrigPtr = getUInt32(); origPtr = (tmpOrigPtr < 0 ? -tmpOrigPtr : tmpOrigPtr) - 1; initModels(); for (i = 0; i < 256; i++) yy[i] = i; for (block_end = 0; ; block_end++) { unsigned nextSym; nextSym = getSymbol(&models[MODEL_BASIS]); if (nextSym == VAL_RUNA || nextSym == VAL_RUNB) { /* Acquire run-length bits, most significant first */ unsigned n; n = 0; do { n <<= 1; n++; if (nextSym == VAL_RUNA) n++; nextSym = getSymbol(&models[MODEL_BASIS]); } while (nextSym == VAL_RUNA || nextSym == VAL_RUNB); if (block_end + n > limit) invalid_input("file corrupt"); memset(&ll[block_end], yy[0], n); block_end += n; } /* if */ if (nextSym == VAL_EOB) break; nextSym = getMTFVal(nextSym); assert(INRANGE(nextSym, 1, 255)); if (block_end >= limit) invalid_input("file corrupt"); ll[block_end] = yy[nextSym]; memmove(&yy[1], &yy[0], nextSym); yy[0] = ll[block_end]; } /* for */ return tmpOrigPtr < 0; } /* getAndMoveToFrontDecode */
bool App::OnInit() { _frame = new GLFrame( "Hello World", wxPoint(50, 50), wxSize(1024, 768) ); _frame->Show( true ); initShader("E:/Vault/glmanv2/vir.json"); initUniforms(); initModels(); initTextures(); ControlFrame* controlFrame = new ControlFrame(); controlFrame->Show( true ); _eventTimer = new wxTimer(this, kEventTimerId); _eventTimer->Start(1, wxTIMER_CONTINUOUS); return true; }
void QgsDualView::init( QgsVectorLayer* layer, QgsMapCanvas* mapCanvas, const QgsFeatureRequest &request, const QgsAttributeEditorContext &context ) { if ( !layer ) return; mEditorContext = context; connect( mTableView, SIGNAL( willShowContextMenu( QMenu*, QModelIndex ) ), this, SLOT( viewWillShowContextMenu( QMenu*, QModelIndex ) ) ); mTableView->horizontalHeader()->setContextMenuPolicy( Qt::CustomContextMenu ); connect( mTableView->horizontalHeader(), SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( showViewHeaderMenu( QPoint ) ) ); connect( mTableView, SIGNAL( columnResized( int, int ) ), this, SLOT( tableColumnResized( int, int ) ) ); initLayerCache( layer, !request.filterRect().isNull() ); initModels( mapCanvas, request ); mConditionalFormatWidget->setLayer( layer ); mTableView->setModel( mFilterModel ); mFeatureList->setModel( mFeatureListModel ); delete mAttributeForm; mAttributeForm = new QgsAttributeForm( layer, QgsFeature(), mEditorContext ); if ( !context.parentContext() ) { mAttributeEditorScrollArea = new QScrollArea(); mAttributeEditorScrollArea->setWidgetResizable( true ); mAttributeEditor->layout()->addWidget( mAttributeEditorScrollArea ); mAttributeEditorScrollArea->setWidget( mAttributeForm ); } else { mAttributeEditor->layout()->addWidget( mAttributeForm ); } connect( mAttributeForm, SIGNAL( attributeChanged( QString, QVariant ) ), this, SLOT( featureFormAttributeChanged() ) ); connect( mAttributeForm, SIGNAL( modeChanged( QgsAttributeForm::Mode ) ), this, SIGNAL( formModeChanged( QgsAttributeForm::Mode ) ) ); connect( mMasterModel, SIGNAL( modelChanged() ), mAttributeForm, SLOT( refreshFeature() ) ); connect( mAttributeForm, SIGNAL( filterExpressionSet( QString, QgsAttributeForm::FilterType ) ), this, SIGNAL( filterExpressionSet( QString, QgsAttributeForm::FilterType ) ) ); connect( mFilterModel, SIGNAL( sortColumnChanged( int, Qt::SortOrder ) ), this, SLOT( onSortColumnChanged() ) ); if ( mFeatureListPreviewButton->defaultAction() ) mFeatureList->setDisplayExpression( mDisplayExpression ); else columnBoxInit(); // This slows down load of the attribute table heaps and uses loads of memory. //mTableView->resizeColumnsToContents(); mFeatureList->setEditSelection( QgsFeatureIds() << mFeatureListModel->idxToFid( mFeatureListModel->index( 0, 0 ) ) ); }
FrmSampling::FrmSampling(RoleDef* inRoleDef, Sample* inSample, DateModel* inTDateTime, RuleChecker* ruleCheckerPtr, QWidget *parent, Qt::WFlags flags): GenericTab(0, inRoleDef, inSample,inTDateTime,tr("Sampling Technique"), ruleCheckerPtr, parent, flags){ setupUi(this); m_submitted=false; tSampLevels=0; tRefSampTec=0; tRefLevels=0; mapper1=0; mapper2=0; nullDellegate=0; m_mode=FrmSampling::NONE; initModels(); initUI(); }
void QgsDualView::init( QgsVectorLayer* layer, QgsMapCanvas* mapCanvas, const QgsFeatureRequest &request, QgsAttributeEditorContext context ) { mEditorContext = context; connect( mTableView, SIGNAL( willShowContextMenu( QMenu*, QModelIndex ) ), this, SLOT( viewWillShowContextMenu( QMenu*, QModelIndex ) ) ); initLayerCache( layer ); initModels( mapCanvas, request ); mTableView->setModel( mFilterModel ); mFeatureList->setModel( mFeatureListModel ); mAttributeDialog = new QgsAttributeDialog( layer, NULL, false, NULL, true, mEditorContext ); if ( mAttributeDialog->dialog() ) mAttributeEditorLayout->addWidget( mAttributeDialog->dialog() ); columnBoxInit(); }
FrmFrame::FrmFrame(Sample* inSample, DateModel* inTDateTime,QWidget *parent, Qt::WFlags flags): GenericTab(0,inSample,inTDateTime,tr("frame"),parent,flags){ setupUi(this); tRefFrame=0; tFrameTime=0; m_tabsDefined=false; m_curFrameTime=-1; customDtStart->setIsDateTime(true,false,false); customDtStart->setIsUTC(false); customDtStart->setIsAuto(false); customDtEnd->setIsDateTime(true,false,false); customDtEnd->setIsUTC(false); customDtEnd->setIsAuto(false); connect(toolView, SIGNAL(clicked()), this, SLOT(onShowFrameDetails()));//TODO:change curidex to grabb the id connect(toolEdit, SIGNAL(clicked()), this, SLOT(onShowFrameDetails())); connect(this, SIGNAL(hideFrameDetails(bool)), this, SLOT(onHideFrameDetails())); initModels(); bool bDate, bTime; customDtStart->getIsDateTime(bDate,bTime); m_tDateTime->insertNewRecord(customDtStart->getIsAuto(),bDate,bTime); customDtEnd->getIsDateTime(bDate,bTime); m_tDateTime->insertNewRecord(customDtStart->getIsAuto(),bDate,bTime); mapper1=0; mapper2=0; mapperStartDt=0; mapperEndDt=0; m_submitted=false; initUI(); initMappers(); }
FrmCatch::FrmCatch(Sample* inSample, DateModel* inTDateTime, QWidget *parent, Qt::WFlags flags): PreviewTab(7,inSample,inTDateTime,tr("Catch"),parent, flags){ setupUi(this); connect(pushPrevious, SIGNAL(clicked()), this, SLOT(goBack())); connect(this, SIGNAL(blockCatchUISignals(const bool)), catchInputCtrl, SIGNAL(blockWidgetsSignals(const bool))); tCatch=0; viewCatch=0; mapper1=0; nullDelegate=0; initModels(); initUI(); initMappers(); }
bool Game::init() { m_pPipe = new Pipeline(); m_pPipe->setCamera(m_windowWidth, m_windowHeight); m_pPipe->init(); m_pGameCamera = m_pPipe->getCamera(); m_pShadowMap = new ShadowMap(); if(!m_pShadowMap->initShadow(m_windowWidth, m_windowHeight)) return false; m_pLightingEffect = new LightingTechnique(); if(!m_pLightingEffect->init()) return false; m_pLightingEffect->enable(); m_pLightingEffect->setSpotLights(1, m_pSpotLight); m_pLightingEffect->setTextureUnit(0); m_pLightingEffect->setShadowMapTextureUnit(1); m_pShadowMapEffect = new ShadowMapTechnique(); if(!m_pShadowMapEffect->init()) return false; if(!initModels()) std::cout << "LOG: Models error" << std::endl; if(!initSkybox()) std::cout << "LOG: Skybox initialization error!" << std::endl; /* if(!initHeightmap()) std::cout << "LOG: Heightmap initialization error!" << std::endl; */ cam = m_pGameCamera; glfwSetMouseButtonCallback(m_pWindow, Game::mouseButtonWrapper); glfwSetCharCallback(m_pWindow, Game::keyboardCharactersWrapper); glfwSetCursorPosCallback(m_pWindow, Game::mousePosWrapper); glfwSetKeyCallback(m_pWindow, Game::keyboardWrapper); return true; }
SqliteTrainerModel::SqliteTrainerModel(QObject *parent, QString fileName) : TrainerModel(parent) { m_cardItemModel = new CardItemModel(this); m_cardItemModel->setObjectName("card_items"); QSqlError err; QSqlDatabase db = QSqlDatabase::database(fileName); if(!db.isValid()) { db = QSqlDatabase::addDatabase("QSQLITE", fileName); db.setDatabaseName(fileName); } if (!db.open()) { err = db.lastError(); db = QSqlDatabase(); QSqlDatabase::removeDatabase(fileName); } if(err.isValid()) { qWarning() << err.text(); } else { qDebug() << fileName << "opened"; m_db = db; QVariant v = db.driver()->handle(); if (v.isValid() && qstrcmp(v.typeName(), "sqlite3*")==0) { // v.data() returns a pointer to the handle sqlite3 *handle = *static_cast<sqlite3 **>(v.data()); if (handle != 0) { // check that it is not NULL sqlite3_trace(handle,trace,NULL); } } initCardItemModel(); initModels(); } }
void QgsDualView::init( QgsVectorLayer* layer, QgsMapCanvas* mapCanvas, QgsDistanceArea myDa ) { mDistanceArea = myDa; connect( mTableView, SIGNAL( willShowContextMenu( QMenu*, QModelIndex ) ), this, SLOT( viewWillShowContextMenu( QMenu*, QModelIndex ) ) ); connect( layer, SIGNAL( editingStarted() ), this, SLOT( editingToggled() ) ); connect( layer, SIGNAL( beforeCommitChanges() ), this, SLOT( editingToggled() ) ); initLayerCache( layer ); initModels( mapCanvas ); mTableView->setModel( mFilterModel ); mFeatureList->setModel( mFeatureListModel ); mAttributeDialog = new QgsAttributeDialog( layer, 0, false, myDa ); if ( mAttributeDialog->dialog() ) mAttributeEditorLayout->addWidget( mAttributeDialog->dialog() ); columnBoxInit(); }
bool SMwriter_smc_old::open(FILE* file, int bits) { initVertexBuffer(1024); initEdgeBuffer(1024); vertex_hash = new my_vertex_hash; dv = new DynamicVector(); lc = new LittleCache(); initEncoder(file); initModels(1); // write precision re_conn->encode(25,bits); // store precision (is needed in write_header) precision_bits = bits; v_count = 0; f_count = 0; return true; }
GameEnvironment::GameEnvironment() { std::cout << "Konstruktor gameenvironment" << std::endl; initVariables(); try { initModels(); } catch (Exception e) { MessageBoxA(NULL, "Oops, something went wrong :(\nPlease press OK and restart game", "Error", MB_OK | MB_ICONERROR | MB_SYSTEMMODAL); exit(0); } try { initCollision(); } catch (LoadingFileError e) { MessageBoxA(NULL, e.type().c_str(), "Error", MB_OK | MB_ICONWARNING | MB_SYSTEMMODAL); } catch (Exception e) { MessageBoxA(NULL, "Oops, something went wrong :(\nPlease press OK and restart game", "Error", MB_OK | MB_ICONERROR | MB_SYSTEMMODAL); exit(0); } try { initSound(); } catch (InitFmodError e) { MessageBoxA(NULL, e.type().c_str(), "Error", MB_OK | MB_ICONERROR | MB_SYSTEMMODAL); exit(0); } catch (SoundError e) { MessageBoxA(NULL, e.type().c_str(), "Error", MB_OK | MB_ICONERROR | MB_SYSTEMMODAL); exit(0); } catch (Exception e) { MessageBoxA(NULL, "Oops, something with sounds went wrong :(\nPlease press OK and restart game", "Error", MB_OK | MB_ICONERROR | MB_SYSTEMMODAL); exit(0); } try { initShaders(); } catch (LoadingFileError e) { MessageBoxA(NULL, e.type().c_str(), "Error", MB_OK | MB_ICONWARNING | MB_SYSTEMMODAL); } catch (Exception e) { MessageBoxA(NULL, "Oops, something went wrong :(\nPlease press OK and restart game", "Error", MB_OK | MB_ICONERROR | MB_SYSTEMMODAL); exit(0); } }