Is it possible to add a label to a leaflet.circle? - ngx-leaflet

This works, and places a circle on the map
layers = [circle([ 46.95, -122 ], { radius: 5000 })];
Are there any controls (or trix) in ngx-leaflet that would let me do something like this?
layers = [circle([ 46.95, -122 ], { radius: 5000, label:'my label' })];
the same way that https://github.com/w8r/leaflet-labeled-circle works.
Or - how should I use the leaflet-labelede-circle together with ngx-leaflet?

You would need to include the leaflet-labeled-circle plugin into your project and ensure it is loaded with Leaflet when you create your layers.
You can see examples of loading third party libraries here:
https://github.com/Asymmetrik/ngx-leaflet-tutorial-plugins

Related

Problem painting a map with Openlayers using Vue

I'm writing an application in Vue that will have a map in it. I want to add some points in that map. The code relevant to the map is,
<div>
<vl-map :load-tiles-while-animating="true" :load-tiles-while-interacting="true" data-projection="EPSG:4326" style="height: 400px">
<vl-view :zoom.sync="zoom" :center.sync="center" :rotation.sync="rotation"></vl-view>
<vl-layer-tile>
<vl-source-osm></vl-source-osm>
</vl-layer-tile>
<vl-layer-vector>
<vl-source-vector :features="points"></vl-source-vector>
</vl-layer-vector>
</vl-map>
</div>
Here points is part of data points: []
If I write the points directly in data everything works.
Like,
points: [
{
type: 'Feature',
geometry: {
type: 'Point',
coordinates: [0.0, 0.0]
},
properties: {}
]
shows a point in [0, 0].
However, I need to use a method that will call several APIs to find out the points that I need to show. It's when I write the code to prepare the points to have the correct value when everything stops working. I'm writing this code in the mounted section.
async calculatePoints () {
this.points = // points as I want them to be
}
But this is not working (although some few times works). Any idea what is going on here or which is the best way to handle this?

Gmaps4Rails v2 - removeMarkers() not working after calling addMarkers()

I have a function responsible for hiding/showing markers, so I decided to use removeMarkers() and addMarkers() with a variable which contains all markers displayed on map, preventing AJAX requests. However, removeMarkers() appears to not working when used after addMarkers() function:
#/assets/javascript/general.js.coffee
#buildMap = (markers)->
provider = Gmaps.build(
'Google',
{
builders: { Marker: RichMarkerBuilder},
markers:
clusterer:
gridSize: 50
styles: [
url: "/assets/cluster.png"
textSize: 15
width: 56
height: 56
]
}
)
Gmaps.handler = #clustereredHandler()
Gmaps.handler.buildMap {
provider: provider,
internal: {id: 'map'} }, ->
Gmaps.markers = _.map(markers, (marker_json) ->
marker = Gmaps.handler.addMarker(marker_json)
_.extend marker, marker_json
marker
)
Gmaps.map = Gmaps.handler.getMap()
Gmaps.handler.bounds.extendWith(Gmaps.markers)
Gmaps.handler.fitMapToBounds()
#app/views/stores/index.html.erb
buildMap(<%=raw #hash.to_json %>);
So, I have:
Handler on Gmaps.handler variable;
All markers on Gmaps.markers variable;
Map on Gmaps.map variable.
Steps to failure:
Load map - OK (All markers loaded correctly);
> Gmaps.handler.removeMarkers(Gmaps.markers) - OK (All markers hidden correctly);
> Gmaps.handler.addMarkers(Gmaps.markers) - OK (All markers shown correctly);
> Gmaps.handler.removeMarkers(Gmaps.markers) - FAILURE! (Markers still being displayed);
I'm using 2.1.2version. Is there any fix for it?
Thanks
According to my plunkr here, there is no bug with gmaps4rails.
I feel like you have an issue with your own functions (maybe dont use extend?) and replace with:
marker.json = marker_json
I cant tell much more since they are not included.
I think the issue is in saving the markers. Whenever you add new markers, you overwrite the old ones. Try
Gmaps.markers.push.apply(Gmaps.markers, Gmaps.handler.addMarkers(Gmaps.markers))
to append the new markers instead.

Displaying Custom Images in 'tools' config options of ext.grid.panel

I am only a month old with extjs and still experimenting. My question is: I have a grid panel and within it the 'tools' config options. I am using this to enable/disable a Ext.grid.feature.Grouping variable. The 2 handler functions have the logic to disable/enable the 2 views by clicking on the 2 'cross' buttons that appear on the right side of the header. The logic is fine. However, I would like to display my set of custom images in place of the 'cross' buttons. Can this be done? If yes, how? Do I need to make some changes in the css code for that?
I have looked into the documentation and also done a good search but nothing seems to answer my question.
Specify a custom type config on your tools:
Ext.create('Ext.grid.Panel', {
...
tools: [
{
type: 'enable-grouping',
handler: function() {
...
}
},
{
type: 'disable-grouping',
handler: function() {
...
}
}
]
});
Then define the following classes in a stylesheet to style your new tools:
.x-tool-enable-grouping {
background-image: url('path/to/tool/image/enable-grouping.png');
}
.x-tool-disable-grouping {
background-image: url('path/to/tool/image/disable-grouping.png');
}
The size of a tool image should be 15 x 15 px

QML application launcher similar to iOS

I'm trying to write an application launcher using QtQuick\QML, and I'd like the user experience to be similar to iOS, in terms of having a grid of icons that can be rearranged with icons that "move out of the way" via animated transitions and a "snap to grid" effect if the icon is dropped in an intermediate position. I've tried using GridView and the drag properties, but I can't seem to get the layout do what I want. What would be the best way to implement this type of app using QML? I'm fairly new to QtQuick, and I feel like maybe I'm missing something fundamental that would make this fairly easy\obvious to write.
For putting icons in a grid, you can use the grid view:
http://developer.qt.nokia.com/doc/qt-4.8/qml-gridview.html
Go through the Qt Quick documentation, you will find out how to do this.
This is not directly relevant to implementing the grid of icons, but I recently came across the QML component Loader. This lets you load QML components on demand, and could be useful for the code that launches an app after the icon is selected.
http://doc-snapshot.qt-project.org/5.0/qml-qtquick2-loader.html
I have made Nokia N9 launched look and feel (Maemo 6, or also known as MeeGo).
It is similar, I just scroll from up to down with icons, while you change "pages" from left to right (and vice versa).
I don't know is it best way, but this is how I did icon manager (its shrinked, this is only to give you idea - in reality it is considerably larger):
Item
{
id: root
function getChildAt(x, y) {}
function getIndexOfChild(child) {}
function moveChild(child, x, y)
{
//moving around icons
}
function setIndexToChild(child)
{
//index of child in Grid element (where to drop)
}
Flickable
{
id: scroller
clip: true
//you most likely want HorizontalFlick ("paging" effect you can add on onBeginingXChanged)
flickableDirection: Flickable.VerticalFlick
contentHeight: iconTable.height
contentWidth: iconTable.width
Grid
{
id: iconTable
width: root.width
anchors.top: parent.top
flow: Grid.LeftToRight
spacing: 10
add: Transition
{
NumberAnimation
{
properties: "x,y"
//make desired transition
}
}
move: Transition
{
NumberAnimation
{
properties: "x,y"
//make desired transition
}
}
}
}
}
You could also write down your own implementation of manager in C++ and later on use it in QML.
This is how it looks like:
I created something distantly connected to this recently, the idea is: create a ListView with snapping. Its delegate should contain a GridView. Separate all of the apps into n-element chunks. Then (it's only the idea)
ListModel
{
ListElement { apps: [app1, app2, ..., appn] }
ListElement { apps: [app1, app2, ..., appn] }
....
ListElement { apps: [app1, app2, ..., appk] }
}
Then populate the ListView with this model and the GridView with the apps property.
I don't know whether you can provide drag and drop here, though

Set a default UI across all components in Sencha Touch

Within Sencha Touch, is it possible to define a default UI , like "light" or "dark", that applies to all components (unless overwritten explicitly)?
The aim is to avoid having to declare ui: "dark", or any custom UI that is made, for every element.
Cheers!
You can try this:
Ext.apply(Ext.Component.prototype, {
getUi: function() {
var defaultUi = 'light';
// value of [this.config.ui] is ignored here
// we can use something like forcedUi
return (this.forcedUi) ? this.forcedUi : defaultUi;
}
})
The disadvantage of this code is that we need to specify another variable for applying ui different from 'light' (because variable 'ui' via getUi() will always return 'light'):
...
items: [{
xtype: 'button',
forcedUi: 'dark'
}]
...
I am stuck on Touch 1.1 so sunsay's solution didn't work for me, but this did:
Ext.CustomToolbar = Ext.extend(Ext.Toolbar,
{
ui:'app'
});
Ext.reg('toolbar', Ext.CustomToolbar);
So, it's still component-by-component-type, but not component-by-component-instance. And since you can overwrite the "reg", no need for custom x-types all over the place, either.
I assume that you know about sencha touch styles and themes. Otherwise you can download a pdf file from this link which clearly describes about how to do it...
http://f.cl.ly/items/d9df79f57b67e6e876c6/SenchaTouchThemes.pdf
In it they are mentioning about scss file where you can specify the base-color, ie
$base-color: #4bb8f0 ;
$base-gradient: 'glossy';
Then run it ... you can see the toolbars and buttons created with the color and gradient you have mentioned.