I am looking for realtime scaling of objects/models in ARcore. I found that it can be done using
getScaleController() and PinchGesture class. I have a TransformableNode and I want to use the above method and class for achieving realtime scalling of model to update model's dimensions at runtime.
I checked the documentation already, but it didn't help me.
here is my code
TransformableNode node =
new TransformableNode(arFragment.getTransformationSystem());
node.setParent(anchorNode);
node.setRenderable(modelRenderable);
node.select();
/* After this I want to use PinchGester or PinchGestureListener and
node.getScaleController() to achieve my goal */
Thanks in advance
Related
I was trying to create and save an image with AnyChart for an android application. This image is created without being rendered since the idea is to use the data from a vector to generate the image and save it on the phone's memory. I am using Java for programming the android application.
I have been testing the ".saveAsPng()" and ".saveAsSVG()" functions from the Anychart Library but there has been no success... I don't receive an error but I don't get the image either... and I don't know exactly how to proceed...
I tried to follow this guideline (https://docs.anychart.com/Common_Settings/Server-Side_Rendering) but as I said, I haven't succeeded in generating and saving the file.
This is the code that I have been using:
private class CustomDataEntry2 extends ValueDataEntry {
CustomDataEntry2(double x, Number value) {
super(x, value);
}
}
_
List<DataEntry> dataLateral = new ArrayList<>();
for (int p=0; p<DataX.size();p++) {
dataLateral.add(new CustomDataEntry2(DataY.get(p), DataX.get(p)));
}
AnyChartView anyChartViewLateral = new com.anychart.AnyChartView(this);
APIlib.getInstance().setActiveAnyChartView(anyChartViewLateral);
anyChartViewLateral.setProgressBar(new ProgressBar(this));
Polar polarLateralImage = AnyChart.polar();
polarLateralImage.startAngle(90);
Linear xScaleLateral = Linear.instantiate();
xScaleLateral.minimum(-180).maximum(180);
xScaleLateral.ticks().interval(90);
polarLateralImage.xScale(xScaleLateral);
Line polarSeriesLine = polarLateralImage.line(dataLateral);
polarSeriesLine.closed(false).markers(true);
polarSeriesLine.markers().size(3);
polarLateralImage.autoRedraw(true);
anyChartViewLateral.setChart(polarLateralImage);
polarLateralImage.saveAsPng(400,400,0.3,"testImage.png");
Could anyone tell me what am I missing or what amb I doing wrong? I know I might be asking too much, but if it were possible, I would be happy if someone could provide a code snippet that works.
Thank you very much!
Unfortunately, the current version of the AnyChart Android native library doesn't support exporting features, it was no implemented yet.
I have an android resume building application. I want to generate a PDF of size A4 from my view. Here's how my layout looks like - At the top I have a Top App Bar, and the whole view in encapsulated in drawer. The main part which contains user's details is encapsulated in nestedScrollView, which contains multiple LinearLayout and TextView. In this screenshot below, I have populated it with mock data, but in actuality, I am fetching data from the Firebase Realtime Database and displaying it on the UI.
I tried to understand iTextPdf solution and multiple question of similar type that has been asked here, but I couldn't find something solid. Please help me out, it would be of great help.
Also, please don't close this question by giving a reason that the question doesn't contain any code. It doesn't because I don't have any. I am trying to solve this problem from scratch. I have tried to describe my problem as much as I could.
try this:
create a WebView and copy the text of your edittext in it:
webview.loadData(youredittext.gettext().tostring, "text/html", "UTF-8");
and convert webview to pdf by below function:
private void createWebPrintJob(WebView webView) {
PrintManager printManager = (PrintManager) this
.getSystemService(Context.PRINT_SERVICE);
PrintDocumentAdapter printAdapter =
webView.createPrintDocumentAdapter();
String jobName = getString(R.string.app_name) + " Print Test";
if (printManager != null) {
printManager.print(jobName, printAdapter,
new PrintAttributes.Builder().build());
}
}
after that user can select page size for example A4
There are a lot of libraries that convert layouts to PDF, but let's opt for popular one so we could find answers if we're stuck.
The libraries I listed works like so : They take screenshot of your layout as bitmap image and convert it to pdf.
- 1st solution: iTextPDF https://github.com/itext/itext7 (New Version).
check this detailed tutorial which treates also the case of taking screenshot of a scrollview https://www.codeproject.com/Articles/989236/How-to-Convert-Android-View-to-PDF-2
and this stackoverflow answer https://stackoverflow.com/a/29731275/12802591
- 2nd solution: PdfMyXML library https://github.com/HendrixString/Android-PdfMyXml just follow the steps in the documentation.
They may be other solutions, but these are the popular ones.
Let Me know if it works for you and also if you're stuck. Thank you!
Im pretty pretty new to Dynamic-Jasper, but due to work i had to add a new feature to our already implemented solution.
My Problem
The Goal is to add a Column to a report that consists only out of a background-color based on some Information. I managed to do that, but while testing I stumbled upon a Problem. While all my Columns in the html and pdf view had the right color, the Excel one only colored the fields in the last Color.
While debugging i noticed, that the same colored Fields had the same templateId, but while all Views run through mostly the same Code the Excel one showed different behavior and had the same ID in all fields.
My Code where I manipulate the template
for(JRPrintElement elemt : jasperPrint.getPages().get(0).getElements()) {
if(elemt instanceof JRTemplatePrintText) {
JRTemplatePrintText text = (JRTemplatePrintText) elemt;
(...)
if (text.getFullText().startsWith("COLOR_IDENTIFIER")) {
String marker = text.getFullText().substring(text.getFullText().indexOf('#') + 1);
text.setText("ID = " + ((JRTemplatePrintText) elemt).getTemplate().getId());
int rgb = TypeConverter.string2int(Integer.parseInt(marker, 16) + "", 0);
((JRTemplatePrintText) elemt).getTemplate().setBackcolor(new Color(rgb));
}
}
}
The html view
The Excel view
Temporary Conclusion
The same styles uses the same Objects in the background and the JR-Excel export messes something up by assigning the same Object to all the Fields that I manipulated there. If anyone knows of a misstake by me or potential Solutions to change something different to result the same thing please let me know.
Something different I tried earlier, was trying to set the field in an evaluate Method that was called by Jasper. In that method we assign the textvalue of each field. It contained a map with JRFillFields, but unfortunatelly the Map-Implementation denied access to them and just retuned the Value of those. The map was provided by dj and couldn't be switched with a different one.
Edit
We are using JasperReports 6.7.1
I found a Solution, where I replaced each template with a new one that was supposed to look exactly alike. That way every Field has its own ID guaranteed and its not up to chance, how JasperReports handles its Data internaly.
JRTemplateElement custom =
new JRTemplateText(((JRTemplatePrintText) elemt).getTemplate().getOrigin(),
((JRTemplatePrintText) elemt).getTemplate().getDefaultStyleProvider());
custom.setBackcolor(new Color(rgb));
custom.setStyle(((JRTemplatePrintText) elemt).getTemplate().getStyle());
((JRTemplatePrintText) elemt).setTemplate(custom);
Is there a way to remove the route without clearing the markers? Using function clear() is really bad.
tomtomMap.clear();
route = null;
origin = null;
destination = null;
Is there a function clearRoute() that do not clear the markers.
Take a look at the API reference
https://d221h2fa9j1k6s.cloudfront.net/downloads/mapssdk/APIReferences/JavaDocMap_2.4.376/index.html
I was able to test the function in my project and verified that it works.
tomtomMap.clearRoute() should solve your problem.
Regards!
I'm trying to create a dynamic graph and stream it using the Gephi toolkit. So far, I've followed the toolkit and the streaming plugin tutorials to create a normal graph and stream it to the Gephi GUI.
I'm having a hard time figuring out how to make the graph dynamic - I have managed to add TimeInterval columns to the Node and Edge tables using the AttributeModel but when I open the Timeline window in the GUI, it says that the graph is not dynamic. The models/controllers are a bit confusing to me.
Here's the code that I have right now:
ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
pc.newProject();
Workspace workspace = pc.getCurrentWorkspace();
AttributeController attributeController = Lookup.getDefault().lookup(AttributeController.class);
AttributeModel attributeModel = attributeController.getModel();
AttributeColumn nodeTimeColumn = attributeModel.getNodeTable().addColumn(DynamicModel.TIMEINTERVAL_COLUMN, AttributeType.TIME_INTERVAL, AttributeOrigin.PROPERTY);
AttributeColumn edgeTimeColumn = attributeModel.getEdgeTable().addColumn(DynamicModel.TIMEINTERVAL_COLUMN, AttributeType.TIME_INTERVAL, AttributeOrigin.PROPERTY);
GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
GraphModel graphModel = graphController.getModel();
DirectedGraph graph = graphModel.getDirectedGraph();
// At this point, I want to make the graph dynamic so that I can use
// the Timeline feature when I stream to the GUI.
StreamingServer server = Lookup.getDefault().lookup(StreamingServer.class);
ServerControllerFactory controllerFactory = Lookup.getDefault().lookup(ServerControllerFactory.class);
ServerController serverController = controllerFactory.createServerController(graph);
String context = "/testing";
server.register(serverController, context);
The Gephi Graph Streaming, in principle, is an alternative to visualize in real time changes in a graph using much less memory than loading a big dynamic graph. So, at each point in time, you don't have the full dynamic graph in memory, but a static graph representing the current state of the graph. That's why, by default, the plugin creates and updates just a static graph.
Unfortunately, updating a dynamic graph using graph streaming is not possible yet. We are planning to support it in a near future, and such operations will be available by changing operations the following class:
https://github.com/gephi/gephi-plugins/blob/graph-streaming/StreamingAPI/src/org/gephi/streaming/api/GraphUpdaterEventHandler.java
As you can see in this file, there's no handling of dynamic attributes; new nodes/edges/attributes are added, changed or removed, but there's no update to dynamic columns.