text,view,rotation,openlayers,openlayers-3 , How to rotate text with view using OpenLayers 3


How to rotate text with view using OpenLayers 3

Question:

Tag: text,view,rotation,openlayers,openlayers-3

I am developing a navigation application, which draws planned route on a map. Planned route consists of points connected with a line. Each point is labelled with distance and direction. When I initially draw the route on the map, I calculate text position in a way, where it doesn't interfere with the line - I use offsetX, offsetY and rotation style attributes. Unfortunately, when the map view is rotated, not of the mentioned attributes is changed - text is not rotated. Is there a way, how to rotate the text with the view, so it will remain on it's position relative to the point? I have already tried rotateWithView: true with both image and text parts.

My style is defined like:

return [new ol.style.Style({
        image: new ol.style.Circle({
            radius: 20,
            fill: new ol.style.Fill({color: 'black'}),
            stroke: new ol.style.Stroke({color: 'black', width: 1})
        }),
        text: new ol.style.Text({
            textAlign: "center",
            textBaseline: "middle",
            font: 'normal 1.5rem Arial',
            text: "This is my text",
            fill: new ol.style.Fill({color: 'black'}),
            stroke: new ol.style.Stroke({color: 'black', width: 1}),
            offsetX: 10,
            offsetY: 15,
            rotation: 0.3
        })
    })];

Answer:

Update feature rotation on map view property change event.

map.getView().on('propertychange', function(event) {
    textStyle.setRotation(this.getRotation());
    mySource.changed();
});

var textStyle = new ol.style.Text({
    // ...
});

var layer = new ol.layer.Vector({
    source: mySource,
    style: new ol.style.Style({
        text: textStyle,
        // ...
    })
});

Related:


SQL : Create view using multiple tables and a cursor


sql,view
I have two tables : 'pc' and 'results'. the table 'results' contains so many results of every pc. I need to create view that contains all pc columns and the last result of every pc. I'v tried this but it didn't work. select * from pc,resultat where pc.code_pc=result.code_pc order by...

Parsing html using Selenium - class name contains spaces


python,html,parsing,selenium,text
I'm trying to parse some html using Selenium. The problem is that it raises error in case the class name contains spaces. Here is the tag I'm searching for: <p class="p0 ng-binding">text</p> I've tried these two options: result.find_element_by_class_name('departure').find_element_by_css_selector('p.p0 ng-binding').text result.find_element_by_class_name('departure').find_element_by_class_name('p0 ng-binding').text >>> selenium.common.exceptions.InvalidSelectorException: Message: The given selector p0 ng-binding is...

findOrFail laravel 5 function for specific filed


database,laravel,view,eloquent
This is my code: $get_all = Geo_Postal_us::findOrFail($postal); With this query,laravel try to find ID filed in table. I don't have id filed, for primary key i have postal column. So, how to set function to find value in postal column, not to search from id column ? Thanks,...

Save user input into a Text widget Tkinter when using classes


python,text,tkinter
I want to know how to save text entered by the user in a Text widget when pressing a "submit" button. At the moment, I have the function submitbutton but it comes up with an error when clicking "submit." On another note, I want the top right Label widget to...

How can I create large ASCII text from a string?


html,text
Given a string, for example 'imgur', how can I generate large ASCII text like the following? Thanks. _ (_) _ _ __ ___ __ _ _ _ _ __ | | '_ ` _ \ / _` | | | | '__| | | | | | | | (_|...

Android popup like IOS


android,view,popup
I need to implement popup dialog like in iOS, and show above some view (map point in this case), but don't know how to implement it. Screenshot attached. Will be glad any proposals.

x axis text overlapping in matlab


matlab,text,overlap
My x axis text are overlapping. I am using this code-- clear all A=[1 2 3 4 5 6 7]'; b=1:length(A); figure(1) bar(A) title('Loss Diagram') xlabel('Loss factor') ylabel('kWh/year','fontsiz`enter code here`e',20) grid on set(gca,'Xtick',b,'XtickLabel',{'Horizntl Global Irr. ' 'Effective irr. on coll. ' 'Array nominal energy ' 'PV module loss ' 'charge...

Laravel 5 No query results for model redirect page


laravel,view,eloquent
I have simple form that post values to a controller,everything works fine if a result is returned from the controller , but if there is no result I get error the following error: No query results for model Which works as it should. My question is : Is it possible...

Win 8 App Get text from datatemplate listview


listview,text,windows-8
I'm trying to learn how to make datatemplate in listviews in my win 8 app I have the following code in my Xaml code <!-- Vertical scrolling item list --> <ListView x:Name="itemListView" Margin="0,4.714,10,0.429" ItemsSource="{Binding Source={StaticResource itemsViewSource}}" SelectionChanged="itemListView_SelectionChanged" Loaded="itemListView_Loaded" Grid.Row="4" Tapped="itemListView_Tapped_1"> <ListView.ItemTemplate> <DataTemplate> <Grid Height="110" Margin="6"> <Grid.ColumnDefinitions>...

Trying to get just the text from a node with filter(), but is returning an object?


javascript,jquery,dom,text
I am simply trying to extract the text without any of the elements from a DOM node with var textIWant = $('.classname').contents().filter(function(){ return this.nodeType === 3; })[1]; This returns to me what looks like a string in the console, something untrimmed like.. " text I want " so when I...

How can I wrap text in QGraphicsItem?


qt,text,word-wrap,qgraphicsitem
1) How can I wrap text in a QGraphicsTextItem to fit a fixed rectangle, with width and height ? Right now I am experimenting with creating a text, getting its bounding rectangle, and resizing it to fit the box - but I can't get wrapping. class TTT: public QGraphicsTextItem {...

Getting response but view is not updating - AngularJS


angularjs,rest,view,binding
I am trying to get the response from a url and populate in the view, but I am do not see the view getting updated. Help me to resolve this issue. Thanks Source <!DOCTYPE html> <html ng-app="myModule"> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script> </head> <body ng-init="priceList='promo03'"> <div ng-controller="PricingController" > <div ng-repeat="item in finalList...

odoo v8 - Field(s) `arch` failed against a constraint: Invalid view definition


python,xml,view,odoo,add-on
I want to create a new view with a DB-view. When I try to install my app, DB-view was created then I get error: 2015-06-22 12:59:10,574 11988 ERROR odoo openerp.addons.base.ir.ir_ui_view: Das Feld `datum` existiert nicht Fehler Kontext: Ansicht `overview.tree.view` [view_id: 1532, xml_id: k. A., model: net.time.overview, parent_id: k. A.] 2015-06-22...

Removing the blank positions (x,y) from a text file in Python?


python,text
I'm working on object tracking from video files, I have 5 to 6 objects in each frame of the video. Due to some bugs in the code there are some frames that are skipped and show as blank spaces in the text file . Like below 5.0 2.3 5.4 5.2...

c++ gives Segmentation Fault from text file of all 0's


c++,text,zero,fault
I'm writing a really simple code (or so I thought) that requires 2 text files to be read in. One is full of a bunch of data points (of type double) and the other one happens to be a bunch of 0's (this is only SOMETIMES filled with 0's, sometimes...

Extract lines from File2 already found File1


linux,text,awk,sed,grep
Using linux commandline, i need to output the lines from text file2 that are already found in file1. File1: C A G E B D H F File2: N I H J K M D L A Output: A D H Thanks!...

Stop text from leaking out of div [on hold]


html,css,text
I have some text which is contained in a div, however if it's too long, it leaks outside of the div and I don't want that. I dont want to use the overflow attribute and give it a scroll bar. Id like it to put the "..." at the end...

how can I add text to these rectangles?


python,text,menu,pygame,python-3.4
This is the code I have started to use to make a start menu. # we need some colours!! black = (0,0,0) white = (255,255,200) red = (200,0,0) green = (0, 200, 0) bright_red = (255, 0 ,0) bright_green = (0, 255, 0) bright_white = (255, 255, 255) def main():...

How do I make the text of one label node take up 2 lines?


xcode,string,swift,text,sklabelnode
I have this text below that is too long to fit on the screen when it runs. How can I make this 2 lines rather than one? myLabel.text = "The weather today is going to be partly cloudy with a chance of rain" ...

Python outputs a .txt file, which's format differs depending on the text editor I use to open it


python,text,output
So I have some python code taht outputs some data to a .txt file like this: f3 = codecs.open(r'C:\Users\dimrizo\Desktop\PythonData\GTFS\routes.txt','w+',"UTF-8") f3.write('route_id,agency_id,route_short_name,route_long_name,route_desc,route_type,route_url,route_color,route_text_color\n') f3.write('blah,blah,blah,blah,blah,blah,blah,blah,blah\n') Problem is that if I open the produced file with the simple windows text editor the text is not properly formatted. The "\n" don't even count. If I open...

How to check weather the indirect child exists in View or not?


android,android-layout,view
Here is my layout. <LinearLayout android:id="@+id/lyt_linearNative" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:visibility="gone" > <LinearLayout android:id="@+id/lyt_tp1" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <ImageView android:id="@+id/vmax_iv_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/bee7_btn_close" />...

DirectWrite align text center


c++,text,directx,direct2d,directwrite
I am trying to align center the text I have to draw. I use ID2D1RenderTarget::DrawTextLayout method. The problemn is that if I set the text horizontal alignment to DWRITE_TEXT_ALIGNMENT_LEADING (the default value) the text is drawn proberly, but if I change this value to DWRITE_TEXT_ALIGNMENT_CENTER the text is shifted right....

Entity Framework code-first: querying a view with no primary key


sql,oracle,entity-framework,view,ef-code-first
Our customer has given the access to views in which there is no primary key is defined. I know Entity Framework needs a primary key for table to identify. But for views not having primary key is it still possible to query. I try to find but always Entity Framework...

calling the parent controller function in Ext.Ajax.request


extjs,view,controller,scope
I have a login Page which authenticates the user.On correct username and password it should hide the loginview and display the next view.When I call the function to do the same it gives an error saying "Uncaught TypeError: this.functionname is not a function.Here is my code for the same: startMain...

Unable to modify variables from separate thread


c#,multithreading,winforms,text,file-io
So I'm making a C# app which has to continuously read and display the contents of a text file, while allowing the user to enter something into a text box and append it to the end of that very file. I'm doing this by running my read method on a...

Text showing on two lines with span


html,css,text
Please see below HTML and CSS code. HTML: <a class="navbar-brand" href="/index.php"> <img src="/img/logo.png" alt="logo"></a> <span class="navbar-brand" style="font-family:'Arial';font-size:24pt">WEBSITE NAME</span> CSS: .navbar-brand { width: 88px; height: 88px; } .navbar-brand img { width: 100%; height: auto; } The problem I'm having is that the text in the span (WEBSITE NAME) is showing on...

Changing a read-only file [on hold]


python,text
I need to change text documents. The way I've been doing it is making a new file, copying everything line by line from the old file and making changes on the way, then saving the new file as the old file's name. This becomes a problem when I only have...

RichTextbox write in place to current line


c#,text,visual-studio-2013,richtextbox
Clarification: I want to output line of text to the same "position" in a RichTextBox, replacing the previous line. In C# Windows Forms Application trying to use RichTextBox for displaying messages. Most of the messages are appended, so that is fine but at one point in the program it has...

Python - Select specific value from test file


python,file,text
I'm absolute beginner in python, and I'd like to get field i.e. from 2nd column, 3rd row from text file like this: 176a AUGCACGUACGUA ACGUA AGUCU 156b GACUACAUGCAUG GCAUA AGCUA 172e AGCUCAGCUAGGC CGAGA CGACU (text is separated by spaces). is there any simple way to do that?...

Can I put StreamReaders in a list? Or any other way to read a lot of text files at once?


c#,list,text,streamreader
I have a lot of text files and want to read them all by once, how do I do this? This is my code till now: List<StreamReader> lijst = new List<StreamReader>(); using (StreamReader qwe = new StreamReader("C:\\123.txt")) using (StreamReader qwer = new StreamReader("C:\\1234.txt")) lijst.Add(qwe); lijst.Add(qwer); But I get an ObjectDisposedException(Cannot...

Refreshing SQL view after adding a default constraint to one of its tables


sql,table,view,refresh
How exactly can I refresh the view after adding a default constraint to one of the tables that makes up the view? I tried to use the sp_refreshview stored procedure but that didn't actually update the view. Here is the code I wrote to update one of columns with a...

HTML make your own