• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java GeoPackageConstants类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: setUpCreate

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

	GeoPackageManager manager = GeoPackageFactory.getManager(activity);

	// Delete
	manager.delete(TestConstants.TEST_DB_NAME);

	// Create
	manager.create(TestConstants.TEST_DB_NAME);

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

	TestCase.assertEquals("Application Id", geoPackage.getApplicationId(), GeoPackageConstants.APPLICATION_ID);
	TestCase.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);
	TestCase.assertEquals("Major User Version", geoPackage.getUserVersionMajor(), Integer.valueOf(majorVersion).intValue());
	TestCase.assertEquals("Minor User Version", geoPackage.getUserVersionMinor(), Integer.valueOf(minorVersion).intValue());
	TestCase.assertEquals("Patch User Version", geoPackage.getUserVersionPatch(), Integer.valueOf(patchVersion).intValue());

	if (features) {
		setUpCreateFeatures(geoPackage, allowEmptyFeatures);
	}

	if (tiles) {
		setUpCreateTiles(testContext, geoPackage);
	}

	setUpCreateCommon(geoPackage);

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


示例17: setApplicationId

import mil.nga.geopackage.GeoPackageConstants; //导入依赖的package包/类
/**
 * Set the GeoPackage application id
 */
public void setApplicationId() {
	setApplicationId(GeoPackageConstants.APPLICATION_ID);
}
 
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:7,代码来源:GeoPackageCoreConnection.java


示例18: fromBytes

import mil.nga.geopackage.GeoPackageConstants; //导入依赖的package包/类
/**
 * Populate the geometry data from the bytes
 * 
 * @param bytes
 */
public void fromBytes(byte[] bytes) {
	this.bytes = bytes;

	ByteReader reader = new ByteReader(bytes);

	// Get 2 bytes as the magic number and validate
	String magic = null;
	try {
		magic = reader.readString(2);
	} catch (UnsupportedEncodingException e) {
		throw new GeoPackageException(
				"Unexpected GeoPackage Geometry magic number character encoding: Expected: "
						+ GeoPackageConstants.GEO_PACKAGE_GEOMETRY_MAGIC_NUMBER);
	}
	if (!magic
			.equals(GeoPackageConstants.GEO_PACKAGE_GEOMETRY_MAGIC_NUMBER)) {
		throw new GeoPackageException(
				"Unexpected GeoPackage Geometry magic number: "
						+ magic
						+ ", Expected: "
						+ GeoPackageConstants.GEO_PACKAGE_GEOMETRY_MAGIC_NUMBER);
	}

	// Get a byte as the version and validate, value of 0 = version 1
	byte version = reader.readByte();
	if (version != GeoPackageConstants.GEO_PACKAGE_GEOMETRY_VERSION_1) {
		throw new GeoPackageException(
				"Unexpected GeoPackage Geometry version: "
						+ version
						+ ", Expected: "
						+ GeoPackageConstants.GEO_PACKAGE_GEOMETRY_VERSION_1);
	}

	// Get a flags byte and then read the flag values
	byte flags = reader.readByte();
	int envelopeIndicator = readFlags(flags);
	reader.setByteOrder(byteOrder);

	// Read the 5th - 8th bytes as the srs id
	srsId = reader.readInt();

	// Read the envelope
	envelope = readEnvelope(envelopeIndicator, reader);

	// Save off where the WKB bytes start
	wkbGeometryIndex = reader.getNextByte();

	// Read the Well-Known Binary Geometry if not marked as empty
	if (!empty) {
		geometry = WkbGeometryReader.readGeometry(reader);
	}

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


示例19: setUserVersion

import mil.nga.geopackage.GeoPackageConstants; //导入依赖的package包/类
/**
 * Set the GeoPackage user version
 * 
 * @since 1.2.1
 */
public void setUserVersion() {
	setUserVersion(GeoPackageConstants.USER_VERSION);
}
 
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:9,代码来源:GeoPackageCoreConnection.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PrincipalBearingPrincipalResolver类代码示例发布时间:2022-05-22
下一篇:
Java RoutingTable类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap