void setup() { #ifndef INSTALL useSharedData(); #endif loadSettings(); tracker.setup(); tracker.setHaarMinSize(175); tracker.setRescale(.25); tracker.setIterations(3); tracker.setTolerance(2); tracker.setClamp(3); tracker.setAttempts(4); #ifdef INSTALL cam.setup(camWidth, camHeight, 30); #else cam.initGrabber(camWidth, camHeight, false); #endif if(rotate) { data.setup(camHeight, camWidth, binSize); } else { data.setup(camWidth, camHeight, binSize); } loadMetadata(data); presence.setDelay(0, 4); presenceFade.setLength(4, .1); presenceFade.start(); shader.load("shaders/colorbalance.vs", "shaders/colorbalance.fs"); ofDisableAntiAliasing(); glPointSize(2); ofSetLineWidth(3); ofSetLogLevel(OF_LOG_VERBOSE); }
bool Plugin::load() { if(DynamicLibrary::load()) if (loadMetadata()) { return loadFactories(); } return false; }
IndexSync::IndexSync(FB::BrowserHost host, ObjectStoreSync& objectStore, TransactionFactory& transactionFactory, Metadata& metadata, const string& name) : Index(name, objectStore.getName()), transactionFactory(transactionFactory), metadata(metadata, Metadata::Index, name), host(host) { loadMetadata(); keyGenerator = auto_ptr<KeyGenerator>(keyPath.is_initialized() ? new Support::KeyPathKeyGenerator(host, keyPath.get()) : NULL); implementation = keyPath.is_initialized() ? Implementation::AbstractDatabaseFactory::getInstance().openIndex( objectStore.getImplementation(), name, keyGenerator, unique, transactionFactory.getTransactionContext()) : Implementation::AbstractDatabaseFactory::getInstance().openIndex( objectStore.getImplementation(), name, unique, transactionFactory.getTransactionContext()); initializeMethods(); }
bool XMLSchema::loadMetadata(xmlNode *startNode, MetadataNode& input) { // Expect metadata in the following form // We are going to skip the root element because we are // expecting to be given one with our input // <pc:metadata> // <Metadata name="root" type=""> // <Metadata name="compression" type="string">lazperf</Metadata> // <Metadata name="version" type="string">1.0</Metadata> // </Metadata> // </pc:metadata> xmlNode *node = startNode; for (node = startNode; node; node = node->next) { if (node->type != XML_ELEMENT_NODE) continue; if (std::string((const char*)node->name) == "Metadata") { const char *fieldname = (const char*)xmlGetProp(node, (const xmlChar*)"name"); const char *etype = (const char*)xmlGetProp(node, (const xmlChar*)"type"); const char *description = (const char*)xmlGetProp(node, (const xmlChar*) "description"); const char *text = (const char*)xmlNodeGetContent(node); if (!Utils::iequals(fieldname, "root")) { if (!fieldname) { std::cerr << "Unable to read metadata for node '" << (const char*)node->name << "' no \"name\" was given"; return false; } input.add(fieldname, text ? text : "", description ? description : ""); } } loadMetadata(node->children, input); } return true; }
void LabeledImage::load(string host) { loadMetadata(host); loadRois(host); }
bool XMLSchema::load(xmlDocPtr doc) { xmlNode* root = xmlDocGetRootElement(doc); // print_element_names(root); if (!Utils::iequals((const char*)root->name, "PointCloudSchema")) { std::cerr << "First node of document was not named 'PointCloudSchema'"; return false; } const unsigned SENTINEL_POS = 100000; unsigned missingPos = SENTINEL_POS + 1; xmlNode* dimension = root->children; pdal::Metadata metadata; for (xmlNode *dimension = root->children; dimension; dimension = dimension->next) { // Read off orientation setting if (std::string((const char*)dimension->name) == "orientation") { xmlChar* n = xmlNodeListGetString(doc, dimension->children, 1); if (!n) { std::cerr << "Unable to fetch orientation.\n"; return false; } std::string orientation = std::string((const char*)n); xmlFree(n); if (Utils::iequals(orientation, "dimension")) m_orientation = Orientation::DimensionMajor; else m_orientation = Orientation::PointMajor; continue; } if (std::string((const char*)dimension->name) == "metadata") { m_metadata = MetadataNode("root"); if (!loadMetadata(dimension, m_metadata)) return false; continue; } if (dimension->type != XML_ELEMENT_NODE || !Utils::iequals((const char*)dimension->name, "dimension")) continue; XMLDim dim; dim.m_position = SENTINEL_POS; for (xmlNode *properties = dimension->children; properties; properties = properties->next) { if (properties->type != XML_ELEMENT_NODE) continue; std::string propName = (const char *)properties->name; propName = Utils::tolower(propName); if (propName == "name") { xmlChar *n = xmlNodeListGetString(doc, properties->children, 1); if (!n) { std::cerr << "Unable to fetch name from XML node."; return false; } dim.m_name = remapOldNames(std::string((const char*)n)); xmlFree(n); } if (propName == "description") { xmlChar* n = xmlNodeListGetString(doc, properties->children, 1); if (!n) { std::cerr << "Unable to fetch description.\n"; return false; } dim.m_description = std::string((const char*)n); xmlFree(n); } if (propName == "interpretation") { xmlChar* n = xmlNodeListGetString(doc, properties->children, 1); if (!n) { std::cerr << "Unable to fetch interpretation.\n"; return false; } dim.m_dimType.m_type = Dimension::type((const char*)n); xmlFree(n); } if (propName == "minimum") { xmlChar* n = xmlGetProp(properties, (const xmlChar*) "value"); if (!n) { return false; std::cerr << "Unable to fetch minimum value.\n"; } dim.m_min = std::atof((const char*)n); xmlFree(n); } if (propName == "maximum") { xmlChar* n = xmlGetProp(properties, (const xmlChar*) "value"); if (!n) { std::cerr << "Unable to fetch maximum value.\n"; return false; } dim.m_max = std::atof((const char*)n); xmlFree(n); } if (propName == "position") { xmlChar* n = xmlNodeListGetString(doc, properties->children, 1); if (!n) { std::cerr << "Unable to fetch position value.\n"; return false; } dim.m_position = std::atoi((const char*)n); xmlFree(n); } if (propName == "offset") { xmlChar* n = xmlNodeListGetString(doc, properties->children, 1); if (!n) { std::cerr << "Unable to fetch offset value!"; return false; } dim.m_dimType.m_xform.m_offset.set((const char*)n); xmlFree(n); } if (propName == "scale") { xmlChar* n = xmlNodeListGetString(doc, properties->children, 1); if (!n) { std::cerr << "Unable to fetch scale value!"; return false; } dim.m_dimType.m_xform.m_scale.set((const char*)n); xmlFree(n); } } // If we don't have a position, set it to some value larger than all // previous values. if (dim.m_position == SENTINEL_POS) dim.m_position = missingPos++; m_dims.push_back(dim); } std::sort(m_dims.begin(), m_dims.end()); // Renumber dimension positions to be 1..N for (unsigned pos = 0; pos < m_dims.size(); pos++) m_dims[pos].m_position = pos + 1; return true; }
QgsMssqlProvider::QgsMssqlProvider( QString uri ) : QgsVectorDataProvider( uri ) , mCrs() , mWkbType( QGis::WKBUnknown ) { QgsDataSourceURI anUri = QgsDataSourceURI( uri ); if ( !anUri.srid().isEmpty() ) mSRId = anUri.srid().toInt(); else mSRId = -1; mWkbType = anUri.wkbType(); mValid = true; mUseWkb = false; mSkipFailures = false; mUseEstimatedMetadata = anUri.useEstimatedMetadata(); mSqlWhereClause = anUri.sql(); mDatabase = GetDatabase( anUri.service(), anUri.host(), anUri.database(), anUri.username(), anUri.password() ); if ( !OpenDatabase( mDatabase ) ) { setLastError( mDatabase.lastError( ).text( ) ); mValid = false; return; } // Create a query for default connection mQuery = QSqlQuery( mDatabase ); // Database successfully opened; we can now issue SQL commands. if ( !anUri.schema().isEmpty() ) mSchemaName = anUri.schema(); else mSchemaName = "dbo"; if ( !anUri.table().isEmpty() ) { // the layer name has been specified mTableName = anUri.table(); QStringList sl = mTableName.split( '.' ); if ( sl.length() == 2 ) { mSchemaName = sl[0]; mTableName = sl[1]; } mTables = QStringList( mTableName ); } else { // Get a list of table mTables = mDatabase.tables( QSql::Tables ); if ( mTables.count() > 0 ) mTableName = mTables[0]; else mValid = false; } if ( mValid ) { if ( !anUri.keyColumn().isEmpty() ) mFidColName = anUri.keyColumn(); if ( !anUri.geometryColumn().isEmpty() ) mGeometryColName = anUri.geometryColumn(); if ( mSRId < 0 || mWkbType == QGis::WKBUnknown || mGeometryColName.isEmpty() ) loadMetadata(); loadFields(); UpdateStatistics( mUseEstimatedMetadata ); if ( mGeometryColName.isEmpty() ) { // table contains no geometries mWkbType = QGis::WKBNoGeometry; mSRId = 0; } } //fill type names into sets mNativeTypes // integer types << QgsVectorDataProvider::NativeType( tr( "8 Bytes integer" ), "bigint", QVariant::Int ) << QgsVectorDataProvider::NativeType( tr( "4 Bytes integer" ), "int", QVariant::Int ) << QgsVectorDataProvider::NativeType( tr( "2 Bytes integer" ), "smallint", QVariant::Int ) << QgsVectorDataProvider::NativeType( tr( "1 Bytes integer" ), "tinyint", QVariant::Int ) << QgsVectorDataProvider::NativeType( tr( "Decimal number (numeric)" ), "numeric", QVariant::Double, 1, 20, 0, 20 ) << QgsVectorDataProvider::NativeType( tr( "Decimal number (decimal)" ), "decimal", QVariant::Double, 1, 20, 0, 20 ) // floating point << QgsVectorDataProvider::NativeType( tr( "Decimal number (real)" ), "real", QVariant::Double ) << QgsVectorDataProvider::NativeType( tr( "Decimal number (double)" ), "float", QVariant::Double ) // string types << QgsVectorDataProvider::NativeType( tr( "Text, fixed length (char)" ), "char", QVariant::String, 1, 255 ) << QgsVectorDataProvider::NativeType( tr( "Text, limited variable length (varchar)" ), "varchar", QVariant::String, 1, 255 ) << QgsVectorDataProvider::NativeType( tr( "Text, fixed length unicode (nchar)" ), "nchar", QVariant::String, 1, 255 ) << QgsVectorDataProvider::NativeType( tr( "Text, limited variable length unicode (nvarchar)" ), "nvarchar", QVariant::String, 1, 255 ) << QgsVectorDataProvider::NativeType( tr( "Text, unlimited length (text)" ), "text", QVariant::String ) << QgsVectorDataProvider::NativeType( tr( "Text, unlimited length unicode (ntext)" ), "text", QVariant::String ) ; }
void ImageSequence::load(string host) { loadMetadata(host); }