当前位置: 首页>>代码示例>>Java>>正文


Java GeoPackageConstants类代码示例

本文整理汇总了Java中mil.nga.geopackage.GeoPackageConstants的典型用法代码示例。如果您正苦于以下问题:Java GeoPackageConstants类的具体用法?Java GeoPackageConstants怎么用?Java GeoPackageConstants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GeoPackageConstants类属于mil.nga.geopackage包,在下文中一共展示了GeoPackageConstants类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: exportGeoPackage

import mil.nga.geopackage.GeoPackageConstants; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void exportGeoPackage(String database, String name, File directory) {

    File file = new File(directory, name);

    // Add the extension if not on the name
    if (!GeoPackageValidate.hasGeoPackageExtension(file)) {
        name += "." + GeoPackageConstants.GEOPACKAGE_EXTENSION;
        file = new File(directory, name);
    }

    // Copy the geopackage database to the new file location
    File dbFile = getFile(database);
    try {
        GeoPackageIOUtils.copyFile(dbFile, file);
    } catch (IOException e) {
        throw new GeoPackageException(
                "Failed read or write GeoPackage database '" + database
                        + "' to file: '" + file, e);
    }
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:25,代码来源:GeoPackageManagerImpl.java

示例2: testWebPExtension

import mil.nga.geopackage.GeoPackageConstants; //导入依赖的package包/类
/**
 * Test the WebP Extension creation
 */
public void testWebPExtension() throws Exception {

    WebPExtension webpExtension = new WebPExtension(geoPackage);

    String tableName = "table";

    Extensions extension = webpExtension.getOrCreate(tableName);
    assertNotNull(extension);
    assertTrue(webpExtension.has(tableName));

    assertEquals(extension.getExtensionName(), WebPExtension.EXTENSION_NAME);
    assertEquals(extension.getAuthor(),
            GeoPackageConstants.GEO_PACKAGE_EXTENSION_AUTHOR);
    assertEquals(extension.getExtensionNameNoAuthor(), WebPExtension.NAME);
    assertEquals(extension.getTableName(), tableName);
    assertEquals(extension.getColumnName(), TileTable.COLUMN_TILE_ROW);
    assertEquals(extension.getScope(), ExtensionScopeType.READ_WRITE);
    assertEquals(extension.getDefinition(), WebPExtension.DEFINITION);

    GeoPackageExtensions.deleteTableExtensions(geoPackage, tableName);
    assertFalse(webpExtension.has(tableName));

}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:27,代码来源:WebPExtensionTest.java

示例3: getExtensionName

import mil.nga.geopackage.GeoPackageConstants; //导入依赖的package包/类
/**
 * Get the extension name of a GeoPackage extension Geometry
 * 
 * @param geometryType
 *            geometry type
 * @return extension name
 */
public static String getExtensionName(GeometryType geometryType) {

	if (!isExtension(geometryType)) {
		throw new GeoPackageException(GeometryType.class.getSimpleName()
				+ " is not an extension: " + geometryType.getName());
	}

	if (!isGeoPackageExtension(geometryType)) {
		throw new GeoPackageException(
				GeometryType.class.getSimpleName()
						+ " is not a GeoPackage extension, User-Defined requires an author: "
						+ geometryType.getName());
	}

	String extensionName = GeoPackageConstants.GEO_PACKAGE_EXTENSION_AUTHOR
			+ Extensions.EXTENSION_NAME_DIVIDER
			+ GeoPackageConstants.GEOMETRY_EXTENSION_PREFIX
			+ Extensions.EXTENSION_NAME_DIVIDER + geometryType.getName();

	return extensionName;
}
 
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:29,代码来源:GeometryExtensions.java

示例4: doInBackground

import mil.nga.geopackage.GeoPackageConstants; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected String doInBackground(Object... params) {

    File databaseFile = (File) params[0];
    String database = (String) params[1];

    // Copy the database to cache
    File cacheDirectory = getDatabaseCacheDirectory();
    cacheDirectory.mkdir();
    cacheFile = new File(cacheDirectory, database + "."
            + GeoPackageConstants.GEOPACKAGE_EXTENSION);
    try {
        GeoPackageIOUtils.copyFile(databaseFile, cacheFile);
    } catch (IOException e) {
        return e.getMessage();
    }

    return null;
}
 
开发者ID:ngageoint,项目名称:geopackage-mapcache-android,代码行数:23,代码来源:GeoPackageManagerFragment.java

示例5: testWebPExtension

import mil.nga.geopackage.GeoPackageConstants; //导入依赖的package包/类
/**
 * Test the WebP Extension creation
 */
@Test
public void testWebPExtension() throws Exception {

	WebPExtension webpExtension = new WebPExtension(geoPackage);

	String tableName = "table";

	Extensions extension = webpExtension.getOrCreate(tableName);
	assertNotNull(extension);
	assertTrue(webpExtension.has(tableName));

	assertEquals(extension.getExtensionName(), WebPExtension.EXTENSION_NAME);
	assertEquals(extension.getAuthor(),
			GeoPackageConstants.GEO_PACKAGE_EXTENSION_AUTHOR);
	assertEquals(extension.getExtensionNameNoAuthor(), WebPExtension.NAME);
	assertEquals(extension.getTableName(), tableName);
	assertEquals(extension.getColumnName(), TileTable.COLUMN_TILE_ROW);
	assertEquals(extension.getScope(), ExtensionScopeType.READ_WRITE);
	assertEquals(extension.getDefinition(), WebPExtension.DEFINITION);

	GeoPackageExtensions.deleteTableExtensions(geoPackage, tableName);
	assertFalse(webpExtension.has(tableName));

}
 
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:28,代码来源:WebPExtensionTest.java

示例6: createAtPath

import mil.nga.geopackage.GeoPackageConstants; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public boolean createAtPath(String database, File path) {

    // Create the absolute file path
    File file = new File(path, database + "." + GeoPackageConstants.GEOPACKAGE_EXTENSION);

    // Create the GeoPackage
    boolean created = createFile(database, file);

    return created;
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:15,代码来源:GeoPackageManagerImpl.java

示例7: createFile

import mil.nga.geopackage.GeoPackageConstants; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public boolean createFile(String database, File file) {

    boolean created = false;

    if (exists(database)) {
        throw new GeoPackageException("GeoPackage already exists: "
                + database);
    } else {

        // Check if the path is an absolute path to the GeoPackage file to create
        if (!GeoPackageValidate.hasGeoPackageExtension(file)) {

            // Make sure this isn't a path to another file extension
            if (GeoPackageIOUtils.getFileExtension(file) != null) {
                throw new GeoPackageException("File can not have a non GeoPackage extension. Invalid File: "
                        + file.getAbsolutePath());
            }

            // Add the extension
            file = new File(file.getParentFile(), file.getName() + "." + GeoPackageConstants.GEOPACKAGE_EXTENSION);
        }

        // Make sure the file does not already exist
        if (file.exists()) {
            throw new GeoPackageException("GeoPackage file already exists: "
                    + file.getAbsolutePath());
        }

        // Create the new GeoPackage file
        GeoPackageDatabase db = new GeoPackageDatabase(SQLiteDatabase.openOrCreateDatabase(file, null));
        createAndCloseGeoPackage(db);

        // Import the GeoPackage
        created = importGeoPackageAsExternalLink(file, database);
    }
    return created;
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:42,代码来源:GeoPackageManagerImpl.java

示例8: testZoomOtherExtension

import mil.nga.geopackage.GeoPackageConstants; //导入依赖的package包/类
/**
 * Test the Zoom Other Extension creation
 */
public void testZoomOtherExtension() throws Exception {

    ZoomOtherExtension zoomOtherExtension = new ZoomOtherExtension(
            geoPackage);

    String tableName = "table";

    Extensions extension = zoomOtherExtension.getOrCreate(tableName);
    assertNotNull(extension);
    assertTrue(zoomOtherExtension.has(tableName));

    assertEquals(extension.getExtensionName(),
            ZoomOtherExtension.EXTENSION_NAME);
    assertEquals(extension.getAuthor(),
            GeoPackageConstants.GEO_PACKAGE_EXTENSION_AUTHOR);
    assertEquals(extension.getExtensionNameNoAuthor(),
            ZoomOtherExtension.NAME);
    assertEquals(extension.getTableName(), tableName);
    assertEquals(extension.getColumnName(), TileTable.COLUMN_TILE_ROW);
    assertEquals(extension.getScope(), ExtensionScopeType.READ_WRITE);
    assertEquals(extension.getDefinition(), ZoomOtherExtension.DEFINITION);

    GeoPackageExtensions.deleteTableExtensions(geoPackage, tableName);
    assertFalse(zoomOtherExtension.has(tableName));

}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:30,代码来源:ZoomOtherExtensionTest.java

示例9: copyToCache

import mil.nga.geopackage.GeoPackageConstants; //导入依赖的package包/类
/**
 * Copy the Uri to the cache directory in a background task
 *
 * @param context
 * @param uri
 * @param path bn
 */
public static void copyToCache(Context context, Uri uri, String path) {

    // Get a cache directory to write to
    File cacheDirectory = CacheUtils.getApplicationCacheDirectory(context);
    if (cacheDirectory != null) {

        // Get the Uri display name, which should be the file name with extension
        String name = MediaUtility.getDisplayName(context, uri, path);

        // If no extension, add a GeoPackage extension
        if(GeoPackageIOUtils.getFileExtension(new File(name)) == null){
            name += "." + GeoPackageConstants.GEOPACKAGE_EXTENSION;
        }

        // Verify that the file is a cache file by its extension
        File cacheFile = new File(cacheDirectory, name);
        if (isCacheFile(cacheFile)) {

            if(cacheFile.exists()) {
                cacheFile.delete();
            }
            String cacheName = MediaUtility.getFileNameWithoutExtension(cacheFile);
            CacheProvider.getInstance(context).removeCacheOverlay(cacheName);

            // Copy the file in a background task
            CopyCacheStreamTask task = new CopyCacheStreamTask(context, uri, cacheFile, cacheName);
            task.execute();
        }
    }
}
 
开发者ID:ngageoint,项目名称:mage-android,代码行数:38,代码来源:CacheUtils.java

示例10: hasGeoPackageExtension

import mil.nga.geopackage.GeoPackageConstants; //导入依赖的package包/类
/**
 * Check the file extension to see if it is a GeoPackage
 * 
 * @param file
 * @return true if GeoPackage extension
 */
public static boolean hasGeoPackageExtension(File file) {
	String extension = GeoPackageIOUtils.getFileExtension(file);
	boolean isGeoPackage = extension != null
			&& (extension
					.equalsIgnoreCase(GeoPackageConstants.GEOPACKAGE_EXTENSION) || extension
					.equalsIgnoreCase(GeoPackageConstants.GEOPACKAGE_EXTENDED_EXTENSION));
	return isGeoPackage;
}
 
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:15,代码来源:GeoPackageValidate.java

示例11: validateGeoPackageExtension

import mil.nga.geopackage.GeoPackageConstants; //导入依赖的package包/类
/**
 * Validate the extension file as a GeoPackage
 * 
 * @param file
 */
public static void validateGeoPackageExtension(File file) {
	if (!hasGeoPackageExtension(file)) {
		throw new GeoPackageException("GeoPackage database file '" + file
				+ "' does not have a valid extension of '"
				+ GeoPackageConstants.GEOPACKAGE_EXTENSION + "' or '"
				+ GeoPackageConstants.GEOPACKAGE_EXTENDED_EXTENSION + "'");
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:14,代码来源:GeoPackageValidate.java

示例12: toBytes

import mil.nga.geopackage.GeoPackageConstants; //导入依赖的package包/类
/**
 * Write the geometry to bytes
 * 
 * @return bytes
 * @throws IOException
 */
public byte[] toBytes() throws IOException {

	ByteWriter writer = new ByteWriter();

	// Write GP as the 2 byte magic number
	writer.writeString(GeoPackageConstants.GEO_PACKAGE_GEOMETRY_MAGIC_NUMBER);

	// Write a byte as the version, value of 0 = version 1
	writer.writeByte(GeoPackageConstants.GEO_PACKAGE_GEOMETRY_VERSION_1);

	// Build and write a flags byte
	byte flags = buildFlagsByte();
	writer.writeByte(flags);
	writer.setByteOrder(byteOrder);

	// Write the 4 byte srs id int
	writer.writeInt(srsId);

	// Write the envelope
	writeEnvelope(writer);

	// Save off where the WKB bytes start
	wkbGeometryIndex = writer.size();

	// Write the Well-Known Binary Geometry if not marked as empty
	if (!empty) {
		WkbGeometryWriter.writeGeometry(writer, geometry);
	}

	// Get the bytes
	bytes = writer.getBytes();

	// Close the writer
	writer.close();

	return bytes;
}
 
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:44,代码来源:GeoPackageGeometryData.java

示例13: testZoomOtherExtension

import mil.nga.geopackage.GeoPackageConstants; //导入依赖的package包/类
/**
 * Test the Zoom Other Extension creation
 */
@Test
public void testZoomOtherExtension() throws Exception {

	ZoomOtherExtension zoomOtherExtension = new ZoomOtherExtension(
			geoPackage);

	String tableName = "table";

	Extensions extension = zoomOtherExtension.getOrCreate(tableName);
	assertNotNull(extension);
	assertTrue(zoomOtherExtension.has(tableName));

	assertEquals(extension.getExtensionName(),
			ZoomOtherExtension.EXTENSION_NAME);
	assertEquals(extension.getAuthor(),
			GeoPackageConstants.GEO_PACKAGE_EXTENSION_AUTHOR);
	assertEquals(extension.getExtensionNameNoAuthor(),
			ZoomOtherExtension.NAME);
	assertEquals(extension.getTableName(), tableName);
	assertEquals(extension.getColumnName(), TileTable.COLUMN_TILE_ROW);
	assertEquals(extension.getScope(), ExtensionScopeType.READ_WRITE);
	assertEquals(extension.getDefinition(), ZoomOtherExtension.DEFINITION);

	GeoPackageExtensions.deleteTableExtensions(geoPackage, tableName);
	assertFalse(zoomOtherExtension.has(tableName));

}
 
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:31,代码来源:ZoomOtherExtensionTest.java

示例14: setUpCreate

import mil.nga.geopackage.GeoPackageConstants; //导入依赖的package包/类
/**
 * Set up the create database
 * 
 * @param directory
 * @param features
 * @param allowEmptyFeatures
 * @param tiles
 * @return GeoPackage
 * @throws SQLException
 * @throws IOException
 */
public static GeoPackage setUpCreate(File directory, boolean features,
		boolean allowEmptyFeatures, boolean tiles) throws SQLException,
		IOException {

	File dbFile = new File(directory, TestConstants.TEST_DB_FILE_NAME);

	// Create
	assertTrue("Database failed to create",
			GeoPackageManager.create(dbFile));

	// Open
	GeoPackage geoPackage = GeoPackageManager.open(dbFile);
	if (geoPackage == null) {
		throw new GeoPackageException("Failed to open database");
	}

	assertEquals("Application Id", geoPackage.getApplicationId(), GeoPackageConstants.APPLICATION_ID);
	assertEquals("User Version", geoPackage.getUserVersion(), GeoPackageConstants.USER_VERSION);
	String userVersionString = String.valueOf(geoPackage.getUserVersion());
	String majorVersion = userVersionString.substring(0, userVersionString.length() - 4);
	String minorVersion = userVersionString.substring(userVersionString.length() - 4, userVersionString.length() - 2);
	String patchVersion = userVersionString.substring(userVersionString.length() - 2);
	assertEquals("Major User Version", geoPackage.getUserVersionMajor(), Integer.valueOf(majorVersion).intValue());
	assertEquals("Minor User Version", geoPackage.getUserVersionMinor(), Integer.valueOf(minorVersion).intValue());
	assertEquals("Patch User Version", geoPackage.getUserVersionPatch(), Integer.valueOf(patchVersion).intValue());
	
	if (features) {
		setUpCreateFeatures(geoPackage, allowEmptyFeatures);
	}

	if (tiles) {
		setUpCreateTiles(geoPackage);
	}

	setUpCreateCommon(geoPackage);

	return geoPackage;
}
 
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:50,代码来源:TestSetupTeardown.java

示例15: getCacheFiles

import mil.nga.geopackage.GeoPackageConstants; //导入依赖的package包/类
private void getCacheFiles(File path, List<File> files){

        if(path.isDirectory()) {
            for (File file : path.listFiles()) {
                getCacheFiles(file, files);
            }
        }else{
            String stringPath = path.getAbsolutePath();
            if(stringPath.endsWith("." + GeoPackageConstants.GEOPACKAGE_EXTENSION)
                    || stringPath.endsWith("." + GeoPackageConstants.GEOPACKAGE_EXTENDED_EXTENSION)){
                files.add(path);
            }
        }
    }
 
开发者ID:ngageoint,项目名称:disconnected-content-explorer-android,代码行数:15,代码来源:ReportManager.java


注:本文中的mil.nga.geopackage.GeoPackageConstants类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。