Fix railway rendering

This commit is contained in:
Victor Shcherb 2012-07-18 01:13:02 +02:00
parent b447b247bf
commit 507d0a3a16
4 changed files with 35 additions and 18 deletions

View file

@ -730,11 +730,11 @@ public class IndexCreator {
public static void main(String[] args) throws IOException, SAXException, SQLException, InterruptedException {
long time = System.currentTimeMillis();
IndexCreator creator = new IndexCreator(new File("/home/victor/projects/OsmAnd/data/osm-gen/")); //$NON-NLS-1$
creator.setIndexMap(false);
creator.setIndexAddress(false);
creator.setIndexMap(true);
creator.setIndexAddress(true);
creator.setIndexPOI(true);
creator.setIndexTransport(false);
creator.setIndexRouting(false);
creator.setIndexTransport(true);
creator.setIndexRouting(true);
// creator.deleteDatabaseIndexes = false;
// creator.recreateOnlyBinaryFile = true;

View file

@ -92,14 +92,16 @@
<filter layer="-1" tag="" value="" order="10" objectType="2"/>
<filter tag="" value="" order="11" objectType="2"/>
<group objectType="3" >
<filter tag="railway" value="platform" order="30" />
<filter tag="railway" value="station" order="30"/>
<filter tag="public_transport" value="station" order="30"/>
<filter tag="public_transport" value="platform" order="30"/>
<group>
<filter tag="railway" value="platform"/>
<filter tag="railway" value="station" />
<filter tag="public_transport" value="station"/>
<filter tag="public_transport" value="platform"/>
<groupFilter>
<filter point="false" cycle="true"/>
<filter point="false" area="true"/>
<filter point="false" cycle="true" objectType="3" order="30"/>
<filter point="false" area="true" objectType="3" order="30"/>
<filter objectType="2" order="58"/>
</groupFilter>
</group>
@ -111,6 +113,7 @@
<filter layer="1" tag="railway" value="" order="66"/>
<filter tag="railway" value="" order="58"/>
<filter tag="public_transport" value="" order="58"/>
<filter layer="1" tag="waterway" value="" order="66"/>
<filter tag="waterway" value="" order="18"/>
@ -1375,8 +1378,13 @@
<filter layer="-1" tag="railway" value="funicular" minzoom="15" color="#666666" strokeWidth="5" pathEffect="5_3" color_2="#cccccc" strokeWidth_2="3"/>
<filter tag="railway" value="funicular" minzoom="15" color="#666666" strokeWidth="2"/>
<filter tag="railway" value="platform" minzoom="15" color="#888888" strokeWidth="3"/>
<filter tag="public_transport" value="platform" minzoom="15" color="#888888" strokeWidth="3"/>
<group>
<filter tag="railway" value="platform"/>
<filter tag="public_transport" value="platform"/>
<groupFilter color="#888888" strokeWidth="4" strokeWidth_2="2" color_2="#bababa" minzoom="16">
<filter minzoom="18" strokeWidth="6" strokeWidth_2="4" />
</groupFilter>
</group>
<!-- Aeroways -->
<filter tag="aeroway" value="runway" color="#bbbbcc">

View file

@ -33,6 +33,7 @@ public class NativeSwingRendering extends NativeLibrary {
private static NativeSwingRendering defaultLoadedLibrary;
public void loadRuleStorage(String path, String renderingProperties) throws SAXException, IOException{
RenderingRulesStorage storage2 = new RenderingRulesStorage();
RenderingRulesStorage storage = new RenderingRulesStorage();
final RenderingRulesStorageResolver resolver = new RenderingRulesStorageResolver() {
@Override
@ -60,7 +61,9 @@ public class NativeSwingRendering extends NativeLibrary {
renderingProps.put(s.substring(0, i).trim(), s.substring(i + 1).trim());
}
}
initRenderingRulesStorage(storage);
this.storage = storage;
}
public NativeSwingRendering(){
@ -118,7 +121,6 @@ public class NativeSwingRendering extends NativeLibrary {
if(request.searchRenderingAttribute(RenderingRuleStorageProperties.A_DEFAULT_COLOR)) {
rctx.defaultColor = request.getIntPropertyValue(request.ALL.R_ATTR_COLOR_VALUE);
System.out.println("!"+ Integer.toHexString(rctx.defaultColor));
}
request.clearState();
request.setIntFilter(request.ALL.R_MINZOOM, zoom);

View file

@ -17,6 +17,7 @@ void loadJniRenderingContext(JNIEnv* env);
void loadJniRenderingRules(JNIEnv* env);
jclass jclassIntArray ;
jclass jclassString;
jmethodID jmethod_Object_toString = NULL;
extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
{
@ -68,13 +69,15 @@ extern "C" JNIEXPORT jboolean JNICALL Java_net_osmand_NativeLibrary_initBinaryMa
// Global object
UNORDERED(map)<void*, RenderingRulesStorage*> cachedStorages;
UNORDERED(map)<std::string, RenderingRulesStorage*> cachedStorages;
RenderingRulesStorage* getStorage(JNIEnv* env, jobject storage) {
if (cachedStorages.find(storage) == cachedStorages.end()) {
cachedStorages[storage] = createRenderingRulesStorage(env, storage);
std::string hash = getStringMethod(env, storage, jmethod_Object_toString);
if (cachedStorages.find(hash) == cachedStorages.end()) {
osmand_log_print(LOG_DEBUG, "Init rendering storage %s ", hash.c_str());
cachedStorages[hash] = createRenderingRulesStorage(env, storage);
}
return cachedStorages[storage];
return cachedStorages[hash];
}
@ -383,6 +386,7 @@ jmethodID jmethod_RouteDataObject_init = NULL;
jclass jclass_NativeRouteSearchResult = NULL;
jmethodID jmethod_NativeRouteSearchResult_init = NULL;
void loadJniRenderingContext(JNIEnv* env)
{
jclass_RenderingContext = findClass(env, "net/osmand/RenderingContext");
@ -407,6 +411,9 @@ void loadJniRenderingContext(JNIEnv* env)
jmethod_RenderingContext_getIconRawData = env->GetMethodID(jclass_RenderingContext,
"getIconRawData", "(Ljava/lang/String;)[B");
jmethod_Object_toString = env->GetMethodID(findClass(env, "java/lang/Object", true),
"toString", "()Ljava/lang/String;");
jclass_JUnidecode = findClass(env, "net/sf/junidecode/Junidecode");
jmethod_JUnidecode_unidecode = env->GetStaticMethodID(jclass_JUnidecode, "unidecode", "(Ljava/lang/String;)Ljava/lang/String;");