I have a PostGIS database containing roads, waterbodies. POI, parks, etc that I have styled in QGIS following the very useful posts: Guide to Advanced Labeling for OSM Roads and “Google Maps”-Style Road Maps in QGIS of Anita Grasser.
I'm a python programmer and I would like to recreate these styles automatically not by hand, is it possible? Could anyone show me any example?
Thank you very much in advance!
In QGIS You can get labeling in command line choose layer and type
layer = iface.activeLayer()
layer.labelling()
You will get instance of QgsAbstractVectorLayerLabeling
https://qgis.org/pyqgis/master/core/Abstract/QgsAbstractVectorLayerLabeling.html?highlight=qgsabstractvectorlayerlabeling
To go to symbol You need type
layer = iface.activeLayer()
layer.renderer()
You will get class QgsFeatureRenderer https://qgis.org/pyqgis/master/core/Feature/QgsFeatureRenderer.html?highlight=qgsfeaturerenderer#qgis.core.QgsFeatureRenderer.symbols
You can also set renderer by
renderer = QgsFeatureRenderer()
layer.setRenderer(renderer)
Related
I am (quite obviously) very new to development. I am trying to get my output chart to save as an image, but after searching I cannot see the toBase64Image class included in the library (really hope I am explaining this well). If someone understood what I am trying to achieve, is there a way to manually input the toBase64Image class? The library I am using is https://github.com/fxcosta/laravel-chartjs and doing this using the Laravel framework.
The only thing toBase64Image is, is a wrapper around the default canvas.toDataUrl so it only renames it. This means you can just get the canvas ID in your application and call the toDataUrl on it
Documentation of toDataUrl: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL
Chart.js implementation: https://github.com/chartjs/Chart.js/blob/1df4883aff050e9e320f9327be96e228fcc588cc/src/core/core.controller.js#L885
Currently Apple provides functions to access data in font tables, like CTFontCopyTable. I'm using it to parse information (kerning, etc) out of a font when available. Is there any similar way of pulling the same data on Windows per font?
I can see a lot of documentation on the windows side when it comes to these font tables, but I can't seem to find a way to pull this data per font.
Here is how I'm pulling the data in osx:
CTFontRef lCTFont = CTFontCreateWithName((CFStringRef)lNSFontName, 800.0f, NULL);
CFDataRef lKernTable = CTFontCopyTable(lCTFont, kCTFontTableKern, kCTFontTableOptionNoOptions);
CFDataRef lGPOSTable = CTFontCopyTable(lCTFont, kCTFontTableGPOS, kCTFontTableOptionNoOptions);
GetFontData will get the raw table data, but as other suggestions advise, you will probably want to use the system-provided text layout methods rather than trying to roll your own.
You can use GetKerningPairs to get kerning data and GetCharacterPlacement to get GPOS data.
If your real intent is to simply render some text correctly though, you might want to use Uniscribe instead.
I would like to set text and 2d images dynamically in Unreal Engine maybe using a placeholder like a Billboard Blueprint then using the Set Text Blueprint.
I am getting json from an external source -- amazon product information -- then want to update the UI Billboard with this json result which includes text and links to image files.
Does anyone know how to achieve this.
Create the string:
FString TestHUDString = FString(TEXT("Buy this crap!"));
FStrings can be set/modified during runtime just like you want it from a std::string
TestHUDString = "buy this other crap....";
And (for example) write it to the "screen":
Canvas->DrawText(BigFont, TestHUDString, 110.0f,110.0f);
You man need to convert your data to a c string or UTF-8 if you have Problems.
Theres also text components of objects if you want to create "in world" billboards for example.
Here the official documentation about using FStrings:
https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/StringHandling/FString/
This should help assuming that you know how to deserialize the json - wich is a different topic imho.
we are planing to create a CMS with zf2 and doctrine orm .
actually we are concern about our cms templating
we want our system works with several templates and easily change between themes via admin
and creating a new templates should be easy for end-users developers
we want an advice or suggest for how to build templating system that :
there is a core module and there a lot sub modules with their own phtml
so where to store theme1 phtml and where to store theme2 phtmls ...
any suggest or advice please
thanks
I encourage you to take a look at Twig, its the best template engine I have seen so far :) It does take some time to learn Twig syntax, but its well worthy if you look at what you get :)
I cant yet write comments, so I wrote this as an answare.
Hope this helps. Trust me, the Twig is the way to go. Joust look at his documentation for more specific details how to use it!
EDIT:
The problem you are trying to solve has nothing to do with template engine. You can do that with any template engine. You can do it even with plain PHP if you want.
I built web application where users can register, get their own sub domain, and there they can build their webpage. Change theme, edit text, add pages. Simple CMS functionality.
The easiest way to do this is to have themes folder, where you would store themes, like this:
themes/
- themeBlue
- css/
- images/
- js/
- html or views/
- themeRose
...
Now this is where you would place all your themes, every theme has its own folder with images, css, js files...
And then you would have users, and every user would be able to choose and change theme.
That information would be stored in database. You need to store that user Jack is using themeBlue. You can do that as you want. You can event put this in users table like user_theme column.
Now when someone visits site, you first query database to see what theme is that user or creator of web using. And then you load all that files from current theme folder. And populate html files with data stored in database like in any other CMS.
This is the simplest implementation. You could for example, store css and html files in database :)
Hope this answers your question.
Good luck with that, I almost gone mad building my system :) I ended up with writing my own PHP MVC Framework joust to accomplish what I wanted.
if you activate another module in the application.config.php which has the same views and layouts (same folder structure and filenames) it's viewscripts and layouts will automatically be used when it's loaded after your core module.
so you could simply make your application.config.php dynamic to load the active template module which only contains the view folder. this would be a simple and effective solution without any other libraries.
additionally you can use an asset manager like assetic to also provide images, css etc. inside of your (template-)modules. (have a look at zf2-assetic-module, I wrote my own assetize-module based on assetic to fit my needs...)
Sina,
I do this in my Application->Module.php onBootstrap
$ss = $serviceManager->get('application_settings_service');
$settings = $ss->loadSettings();
$serviceManager->get('translator');
$templatePathResolver = $serviceManager->get('Zend\View\Resolver\TemplatePathStack');
$templatePathResolver->setPaths(array(__DIR__ . '/view/'.$settings['theme'])); // here is your skin name
$viewModel = $application->getMvcEvent()->getViewModel();
$viewModel->themeurl = 'theme/'.$settings['theme'].'/';
In this situation I have this structure in my view folder
view/
default/
application/
error/
layout/
zfcuser/
red/
application/
error/
layout/
zfcuser/
The $viewmodel above injects a variable into the layout for the themeurl in the public_html folder /theme/red/ with all assets for red
Access in layout.phtml -> themeurl;?> in a viewscript layout()->themeurl;?>
I am still working out my Dynamic Views. Right now I have a BaseController and all my ActionControllers extend it. It has a render() function that builds the required views but not sure its going to be scalable hoping to try some placeholder ideas.
application_settings_service is a Settings Service that gets settings for whatever domain was used to call the system and builds an array accessible via any service aware part of the site. Thats a whole different post and it may or may not rub MVC peeps the wrong way
I know your question is marked answered just thought I would share
Eric
I want to change UIAnnotationView image on mapkit in rubymotion language.
Any one know this, kindly help me.
How about a complete working example? I just tested it :)
A budy and I converted a LOT of iOS code from the iOS Cookbook to RubyMotion
There's a whole chapter on Maps, but the one that looks to answer your question best is this:
https://github.com/IconoclastLabs/rubymotion_cookbook/tree/master/ch_6/06_custompins
It's just like colored pins, but your main difference will be this
pinImage = UIImage.imageNamed("ilpin.png")
annotationView.image = pinImage
Goodluck! - Gant from Iconoclast Labs
I think you mean, an MKAnnotationView? If so, you just need to set the image property to a new UIImage. See this Gist:
https://gist.github.com/3049611
Based on the RubyMotionSamples Beer project - https://github.com/HipByte/RubyMotionSamples/blob/master/Beers/app/beer_map_controller.rb
I have added a new image file called 'signpost.png' under 'resources', and altered the code from using a pin to using a straight up annotation, with the new custom image.
The following code works fine to change the UIAnnotationView's image
view = MKAnnotationView.alloc.initWithAnnotation(annotation, reuseIdentifier:ViewIdentifier)
view.image = UIImage.imageNamed("ptr.jpg")
view.canShowCallout = true
I have saved the image ptr.jpg in resources folder.