How to clip children in qml? - google-maps

I have webView element that display google maps page. I need to show only map, without search input and other content. I have no idea except something like this:
Rectangle {
x: 0
y: 51
height: 549
//something like android clipChildren property
WebView {
id: mapView
x:0
y: -51
width: 800
height: 600
url: ""
onUrlChanged: {
mapView.reload()
}
}
}
but I don't know property that can do it.

Maybe use the clip: true; property which is present on every item in QtQuick ?

Related

Why draggable object jump on the random position jQuery?

I work with draggable and dropablle object, and I have issues with jumping objects on random place.
I have few dropablle areas, and dragable objects, for this I use script:
$('.draggable-box').draggable();
For droping I use this script:
$('.draggable').draggable({
stop(e, ui) {
},
});
$('.grid-item').droppable({
accept: '.draggable',
drop(e, ui) {
ui.draggable.appendTo(this);
},
});
As you can see on attachment it is jumping to random place in the page.
One solution I found:
$('.draggable').draggable({
stop(e, ui) {
$(this).css({
left: 0,
top: 0,
});
},
});
$('.grid-item').droppable({
accept: '.draggable',
drop(e, ui) {
ui.draggable.appendTo(this);
},
});
But on this case it's stuck on one place, I try to change css values top left, it's no working. As I understood it's taking left and top from first storing box, and for this I get width of the box
var width = $(".box-legend").width();
var currentWithd = ui.position.left;
And try to minus from final position like this:
$('.draggable').draggable({
stop(e, ui) {
$(this).css({ left: currentWithd - width})
},
});
But every time when I drag element it's jumping randomly, for now i tried and I have no idea how to fix :(
So end result should be dragging element to the storage box, and this element stay on position not jumping.

html2canvas on esri Map - layers moves

I am trying to create a function in the Angular system which will produce an image of the map using html2canvas
The following is the current function:
window.emapComponent.service.getMap('mapApi').then((map) => {
html2canvas(document.getElementById("mapApi"), { useCORS: true }).then(function (canvas) {
canvas.screenshotDataURI = canvas.toDataURL("image/jpg", 0.5);
canvas.toBlob(function (blob) {
saveAs(blob, oRequest.fileName)
});
});
})
What happens is that in the system itself, as soon as I drag the map with the mouse, the photo comes out weird (file attached)-
I noticed in the elements of html that although I see the objects of the layers adjusted to the map, in practice the div itself is dragged from place to place and this is what I get in the picture
I would be happy to help with this

Widget for a foldable container in qml

What qml widget should I use to create a foldable container? I can't find it.
Example (from Qt Creator):
There is no out of the box widget in QML for that but it should be fairly easy to create it yourself. This is just a primitive example to show how easy it could be to do it but a proper reusable control might be implementend similar like https://doc.qt.io/qt-5/qml-qtquick-controls2-tabbar.html:
import QtQuick 2.11
Column {
width: 600
height: 600
Rectangle {
width: parent.width
height: 50
color: "darkgrey"
MouseArea {
anchors.fill: parent
onClicked: container.height = container.height ? 0 : 500
}
}
Rectangle {
id: container
width: parent.width
height: 500
color: "grey"
}
}

Google Maps and Openlayers 3 integration example

I'm using the Open Layers 3 example located at...
http://openlayers.org/en/v3.0.0/examples/google-map.html
...and I have had some success.
The problem I am running into is getting my OL3 vector and MapServer layers to be projected correctly over the web-Mercator Google Map.
I have used the example as a template but it has not worked.
Currently all MapServer and Vector layers are projected as ESPG:4326 but need to be in Web-Mercator to line up with the under lying google map.
Any help is greatly appreciated!!
You could try the OL3-Google-Maps library, one that combines the use of Google Maps API and OpenLayers together, and see if it fits your needs.
It's not a perfect solution, so be sure to read about the Limitations of the library.
The actual answer that I have implemented is here...
If this helps you please up-vote it to off-set the down-votes this received.
http://openlayers.org/en/v3.0.0/examples/google-map.html
If you need to use google imagery in you OpenLayers map this is the way to do it.
If you are using SPA MVC AngularJS architecture make sure that you make your call to the google API in your page early enough and notice that this example loads both a google div and a OpenLayers div then combines them at the end of loading...so if anything errors or stops the loading process after initialization you will see two div's the google div first and the OpenLayers div under it...once all errors are resolved and you process is able to execute ...
olMapDiv.parentNode.removeChild(olMapDiv);
gmap.controls[google.maps.ControlPosition.TOP_LEFT].push(olMapDiv);
you will see the maps combined.
If you are transforming data from EPSG:4326 to EPSG:3857 you will want to change your view projection to...
var view = new ol.View({
projection: 'EPSG:3857',
// make sure the view doesn't go beyond the 22 zoom levels of Google Maps
maxZoom: 21
});
and you will also want to transform and data points you have coming in, I did it like this...
*shape = data points from data base
var geoJsonObj = {
'type': 'Feature',
'geometry': JSON.parse(shape),
'name': 'YourName',
'id': YourName.YourID
}
var vectorSource = new ol.source.Vector({
features: (new ol.format.GeoJSON()).readFeatures(geoJsonObj, { defaultDataProjection: "EPSG:4326", featureProjection:"EPSG:3857"})
});
YourLayer = new ol.layer.Vector({
title: YourName.YourID,
source: vectorSource,
id: YourName.YourID,
name: 'YourName',
label: response.DataList[key].Label,
fill: response.DataList[key].Color,
stroke: defaultStrokeHex,
style: function (feature, resolution) {
var text = resolution * 100000 < 10 ? response.DataList[key].Label: '';
if (text != "") {
styleCache[text] = [new ol.style.Style({
stroke: new ol.style.Stroke({
color: '#319FD3',
width: 1
}),
text: new ol.style.Text({
font: '12px Calibri,sans-serif',
text: text,
fill: new ol.style.Fill({
color: '#000'
}),
stroke: new ol.style.Stroke({
color: '#fff',
width: 3
})
}),
fill: new ol.style.Fill({
color: Utility.convertHex(response.DataList[key].Shade, '0.5')
})
})];
}
else if (text == "") {
styleCache[text] = [new ol.style.Style({
fill: new ol.style.Fill({
color: Utility.convertHex(response.DataList[key].Shade, '0.5')
})
})
]
} return styleCache[text];
}
});
There is obviously more than you need in the vector layer example above.
...an addendum to the code above
If you want the ability to turn off the satellite imagery layer below you vector data or map-server layers you can not combine the "olmap" and "gmap" div so comment those lines out and add this style to both you "gmap" and "olmap" div's
<div id="gmap" style="padding: 0px; width: 100vw; height: 90vh;z-index: 0; position:absolute"></div>
<div id="olmap" style="padding: 0px; width: 100vw; height: 90vh;z-index: 1; position:absolute"></div>
the only difference being the "z-index" and now you will have control to set the visibility on your "gmap" div dynamically...

ExtJs: Draggable element without Region

I want to create a GoogleMap like draggable div (as in this example http://tech.pro/tutorial/790/javascr...in-a-container).
But with ExtJs I did not find a way to achieve this without get rid of the Region...
I have a container which fit the screen and I have a huge div inside it (more than 10 000 px) which is centered (called it "area").
When I create an Ext.dd.DD class with this "area" element as a target, and start to drag... the DragDrop fonctionnality doesn't work as the div is stuck in the top-left corner.
Any idea on how to achieve this?
(Obviously, I don't want scoll, but drag and drop scroll).
Thanks in advance,
PsychoKrameur
PS: I'm using ExtJs 5.1
With ExtJS 5.1 you can use the TouchScroller, but be careful the class is private. That means it can change in further releases.
Example: https://fiddle.sencha.com/#fiddle/lmn
document.addEventListener("dragstart", function(e) {
e.preventDefault(); //This for the image otherwise it will dragged in IE
});
var panel = Ext.create("Ext.Panel", {
style: {
cursor: "move"
},
width: 400,
height: 400,
items: [{
xtype: "image",
width: 1019,
height: 1019,
src: "http://tech.pro/_sotc/sites/default/files/202/images/duck.jpg"
}],
renderTo: Ext.getBody()
});
Ext.defer(function() {
var childSize = panel.items.first().getSize();
var size = panel.getSize();
var scroller = Ext.scroll.TouchScroller.create({
element: panel.getOverflowEl()
});
scroller.scrollTo(size.width / 2 - childSize.width / 2, size.height / 2 - childSize.height / 2); //center the image
}, 1);