-
Notifications
You must be signed in to change notification settings - Fork 456
Opt-out Z interpolation #715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
d981bb6
849431e
c02aea2
1fc16a8
5ce448d
713f650
fc1690b
489c40c
6a2434c
ce88968
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright (c) 2016 Vivid Solutions. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* and Eclipse Distribution License v. 1.0 which accompanies this distribution. | ||
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v20.html | ||
* and the Eclipse Distribution License is available at | ||
* | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
*/ | ||
package org.locationtech.jts.geom; | ||
|
||
/** | ||
* Internal class which encapsulates the runtime switch to Z-interpolate when applicable. | ||
* <p> | ||
* <ul> | ||
* <li><code>jts.zinterpolating=false</code> - (default) do not Z-interpolate | ||
* <li><code>jts.zinterpolating=true</code> - Z-interpolate | ||
* </ul> | ||
* | ||
* @author bjornharrtell | ||
* | ||
*/ | ||
public class ZInterpolating { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems a lot of boilerplate to hold a boolean value decision, can this class take on more responsibility and swap between interpolation approaches as a stratagy object? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree it feel like boilerplate. I have difficulties properly understanding/interpreting what you mean with "take on more responsibility and swap between interpolation approaches as a stratagy object". In either case it's intentionally done this way because it is modeled after the other existing system property option jts.overlay and broken out into a self contained class because it is affecting two very separate things (RobustLineIntersector and ElevationModel), and I wanted to do it in a way that is as non intrusive as possible on the existing source. I suppose system wide settings could be done with smarter and nicer desig but I don't think this is the place to do such general improvement and restructuring. |
||
public static String ZINTERPOLATING_PROPERTY_NAME = "jts.zinterpolating"; | ||
public static String ZINTERPOLATING_PROPERTY_VALUE_TRUE = "true"; | ||
public static String ZINTERPOLATING_PROPERTY_VALUE_FALSE = "false"; | ||
public static boolean ZINTERPOLATING_DEFAULT = true; | ||
private static boolean isZInterpolating = ZINTERPOLATING_DEFAULT; | ||
|
||
static { | ||
setZInterpolatingImpl(System.getProperty(ZINTERPOLATING_PROPERTY_NAME)); | ||
} | ||
|
||
public static boolean getZInterpolating() { | ||
return isZInterpolating; | ||
} | ||
|
||
public static void setZInterpolating(boolean zInterpolating) { | ||
isZInterpolating = zInterpolating; | ||
} | ||
|
||
private static void setZInterpolatingImpl(String isZInterpolatingCode) { | ||
if (isZInterpolatingCode == null) | ||
return; | ||
isZInterpolating = ZINTERPOLATING_DEFAULT; | ||
if (ZINTERPOLATING_PROPERTY_VALUE_TRUE.equalsIgnoreCase(isZInterpolatingCode)) | ||
isZInterpolating = true; | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.