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.
Related
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)
I'm using edge XTK by directly including http://get.goXTK.com/xtk_edge.js in my html.
Following code snippet shows how I'm referring to files on my server in XTK.
var skull = new X.mesh();
skull.file = 'http://myserver.com/stls/skull.stl?accessingUserId=dave#ibm.com&accessCode=8999';
As you can see, my file uri's have query parameters, which have periods in them. In such cases, XTK fails with error message:
com&accessCode=8999 file format is not supported.
It looks like XTK forgot to consider that file uri's can have query params with periods.
If it is a bug, would you please consider fixing it before release 8.
If I'm doing something wrong, can you please point me in the right direction.
Thank you.
Haha, you're right.. it doesn't work but you could use the following:
var skull = new X.mesh();
skull.file = 'http://myserver.com/stls/skull.stl?accessingUserId=dave#ibm.com&accessCode=8999&skull.stl';
basically just append another '&.stl' to the query.
we just split the url using the last dot to get the extension.. any proposition for a better solution is welcome.
I have images of a character including (head,leftarm, rightarm, body,leftleg,rightleg etc).. I want to join these images to create a character like ragdoll. There is tutorial of joining the body parts but, I am not able to do this with images and sprites.
Can anyone help me.
Thanks.
Yannick Loriot wrote a tutorial here: http://yannickloriot.com/2011/06/box2d-ragdoll-example-for-cocos2d/
The blog post points to the working source code for the app: https://github.com/YannickL/Box2D-Examples
I try to compose new and modify existing multipage TIFFs using Magick++.
Does someone know how I can do this?
I can read a specific page using this code:
Image * img = new Image("path/to/image.tif[0]"); //read page 0
But how can I save changes back to the TIFF? and how can I add new pages?
Google could only tell me things about splitting TIFFs in singe page ones.
Thanks for your help!
I never tried it but what about the writeImages function. Docs are here.
From the docs
Write images in container to file specified by string imageSpec_
I am currently trying to understand a bit more about how Orchard handles Lists of Custom Content Types and I have run into a bit of an issue.
I created a Content Type named Story, which has the following parts:
Body
Common
Containable
Route
I created a list that holds these items, and all I am attempting to do is style them in such a way:
Story Title
Story Description (Basically a truncated version of the body?)
However, I cannot seem to figure out how to do the following:
Get the Title to actually appear (Currently all that appears is the body and a more link)
Remove the "more" link (and change this to be the actual Title)
I have looked into changing the Placement.info, and have looked all over in an attempt to find where the "more" link is added in each of the items. Any help would be greatly appreciated.
I finally managed to figure it out - Thanks to the Designer Tools Module, which made it very simple to go look into what was going on behind the scenes during Page Generation.
Basically - all that was necessary to accomplish this was to make some minor changes to the Parts.Common.Body.Summary.cshtml file. (found via ../Core/Common/Views/)
Which initially resembles the following:
#{
[~.ContentItem] contentItem = Model.ContentPart.ContentItem;
string bodyHtml = Model.Html.ToString();
var body = new HtmlString(Html.Excerpt(bodyHtml, 200).ToString()
.Replace(Environment.NewLine,"</p>"+Environment.NewLine+"<p>"));
}
<p>#body #Html.ItemDisplayLink(T("more").ToString(), contentItem)</p>
however by making a few changes (by using the Designer Tools) I change it into the following:
#{
[~.ContentItem] contentItem = Model.ContentPart.ContentItem;
string bodyHtml = Model.Html.ToString();
string title = Model.ContentPart.ContentItem.RoutePart.Title;
string summary = Html.Excerpt(bodyHtml, 100) + "...";
}
<div class='story'>
<p>
#Html.ItemDisplayLink(title, contentItem)
</p>
<summary>
#summary
</summary>
</div>
Although it could easily be shortened a bit - It does make the styling quite a big easier to handle. Anyways - I hope this helps :)
Alternately you can use the placement.info file in your theme assign different fields to your Summary and Detail views. It's much simplier.
http://orchardproject.net/docs/Understanding-placement-info.ashx
But, I used the same method you did till I discovered the .info file as well. It works and gives you a good understanding of how the system works, but the placement.info file seems easier.
Also, you probably don't want to be editing the view files in Core. I think your meant to override views in your theme directory.