idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
10,000
public Matrix getWorldToPanTransformation ( ) { if ( viewState . getScale ( ) > 0 ) { double dX = - ( viewState . getPanX ( ) * viewState . getScale ( ) ) ; double dY = viewState . getPanY ( ) * viewState . getScale ( ) ; return new Matrix ( viewState . getScale ( ) , 0 , 0 , - viewState . getScale ( ) , dX , dY ) ; } ...
Return the world - to - pan space translation matrix .
10,001
public Matrix getPanToViewTranslation ( ) { if ( viewState . getScale ( ) > 0 ) { double dX = - ( ( viewState . getX ( ) - viewState . getPanX ( ) ) * viewState . getScale ( ) ) + width / 2 ; double dY = ( viewState . getY ( ) - viewState . getPanY ( ) ) * viewState . getScale ( ) + height / 2 ; return new Matrix ( 1 ,...
Return the translation of coordinates relative to the pan origin to view coordinates .
10,002
public Matrix getWorldToPanTranslation ( ) { if ( viewState . getScale ( ) > 0 ) { double dX = - ( viewState . getPanX ( ) * viewState . getScale ( ) ) ; double dY = viewState . getPanY ( ) * viewState . getScale ( ) ; return new Matrix ( 1 , 0 , 0 , 1 , dX , dY ) ; } return new Matrix ( 1 , 0 , 0 , 1 , 0 , 0 ) ; }
Return the translation of scaled world coordinates to coordinates relative to the pan origin .
10,003
public Matrix getWorldToViewScaling ( ) { if ( viewState . getScale ( ) > 0 ) { return new Matrix ( viewState . getScale ( ) , 0 , 0 , - viewState . getScale ( ) , 0 , 0 ) ; } return new Matrix ( 1 , 0 , 0 , 1 , 0 , 0 ) ; }
Return the world - to - view space translation matrix .
10,004
public void setSize ( int newWidth , int newHeight ) { saveState ( ) ; Bbox bbox = getBounds ( ) ; if ( width != newWidth || height != newHeight ) { this . width = newWidth ; this . height = newHeight ; if ( viewState . getScale ( ) < getMinimumScale ( ) ) { double scale = getBestScale ( bbox ) ; doSetScale ( snapToRes...
Set the size of the map in pixels .
10,005
public void translate ( double x , double y ) { saveState ( ) ; doSetOrigin ( new Coordinate ( viewState . getX ( ) + x , viewState . getY ( ) + y ) ) ; fireEvent ( false , null ) ; }
Move the view on the map . This happens by translating the camera in turn .
10,006
public void scale ( double delta , ZoomOption option , Coordinate center ) { setCurrentScale ( viewState . getScale ( ) * delta , option , center ) ; }
Adjust the current scale on the map by a new factor keeping a coordinate in place .
10,007
public Bbox getBounds ( ) { double w = getViewSpaceWidth ( ) ; double h = getViewSpaceHeight ( ) ; double x = viewState . getX ( ) - w / 2 ; double y = viewState . getY ( ) - h / 2 ; return new Bbox ( x , y , w , h ) ; }
Given the information in this MapView object what is the currently visible area?
10,008
private void fireEvent ( boolean resized , ZoomOption option ) { if ( width > 0 ) { boolean sameScale = lastViewState != null && viewState . isPannableFrom ( lastViewState ) ; handlerManager . fireEvent ( new MapViewChangedEvent ( getBounds ( ) , getCurrentScale ( ) , sameScale , viewState . isPanDragging ( ) , resized...
Fire an event .
10,009
private double snapToResolution ( double scale , ZoomOption option ) { double allowedScale = limitScale ( scale ) ; if ( resolutions != null ) { IndexRange indices = getResolutionRange ( ) ; if ( option == ZoomOption . EXACT || ! indices . isValid ( ) ) { return allowedScale ; } else { int newResolutionIndex = 0 ; doub...
Finds an optimal scale by snapping to resolutions .
10,010
private Coordinate calcCenterFromPoint ( final Coordinate worldCenter ) { double xCenter = worldCenter . getX ( ) ; double yCenter = worldCenter . getY ( ) ; if ( maxBounds != null ) { Coordinate minCoordinate = maxBounds . getOrigin ( ) ; Coordinate maxCoordinate = maxBounds . getEndPoint ( ) ; if ( BoundsLimitOption ...
Adjusts the center point of the map to an allowed center point . This method tries to make sure the whole map extent is inside the maximum allowed bounds .
10,011
private void initializeList ( ) { FavouritesCommService . getSearchFavourites ( new DataCallback < List < SearchFavourite > > ( ) { public void execute ( List < SearchFavourite > result ) { favouriteItems . getDataAsRecordList ( ) . removeList ( favouriteItems . getRecords ( ) ) ; for ( SearchFavourite sf : result ) { ...
get favourites from store
10,012
public Geometry getGeometryN ( int n ) { if ( isEmpty ( ) ) { return null ; } if ( n >= 0 && n < points . length ) { return points [ n ] ; } throw new ArrayIndexOutOfBoundsException ( n ) ; }
Return null if the MultiPoint is empty returns one of the points if the requested index exists throws an exception otherwise .
10,013
public Bbox getBounds ( ) { if ( isEmpty ( ) ) { return null ; } double minX = Double . MAX_VALUE ; double minY = Double . MAX_VALUE ; double maxX = - Double . MAX_VALUE ; double maxY = - Double . MAX_VALUE ; for ( Point point : points ) { if ( point . getX ( ) < minX ) { minX = point . getX ( ) ; } if ( point . getY (...
Return the bounding box spanning the full list of points .
10,014
public Coordinate [ ] getCoordinates ( ) { if ( isEmpty ( ) ) { return null ; } Coordinate [ ] coordinates = new Coordinate [ points . length ] ; for ( int i = 0 ; i < points . length ; i ++ ) { coordinates [ i ] = points [ i ] . getCoordinate ( ) ; } return coordinates ; }
Get the full list of coordinates from all the points in this MultiPoint geometry . If this geometry is empty null will be returned .
10,015
public boolean intersects ( Geometry geometry ) { if ( isEmpty ( ) ) { return false ; } for ( Point point : points ) { if ( point . intersects ( geometry ) ) { return true ; } } return false ; }
Return true if any of the points intersect the given geometry .
10,016
public void addFeatures ( Map < VectorLayer , List < Feature > > featureMap , Criterion criterion ) { if ( showDetailsOnSingleResult && featureMap . size ( ) == 1 ) { List < Feature > features = featureMap . values ( ) . iterator ( ) . next ( ) ; if ( features . size ( ) == 1 ) { showFeatureDetailWindow ( map , feature...
Add features in the widget for several layers .
10,017
public ListGridRecord [ ] getSelection ( String layerId ) { String id = tabset . getID ( ) + "_" + constructIdSaveLayerId ( layerId ) ; FeatureListGridTab tab = ( FeatureListGridTab ) tabset . getTab ( id ) ; if ( tab != null ) { return tab . getSelection ( ) ; } return null ; }
Get the selected records for the tab .
10,018
public static boolean isBlank ( Object o ) { if ( o instanceof CharSequence ) { CharSequence cs = ( CharSequence ) o ; return cs == null || new StringBuilder ( cs . length ( ) ) . append ( cs ) . toString ( ) . trim ( ) . isEmpty ( ) ; } if ( o instanceof Iterable ) { Iterable < ? > iter = ( Iterable < ? > ) o ; return...
Checks if an Object is null blank Iterable blank Iterator blank Map blank CharSequence or Boolean . FALSE .
10,019
public void setFeature ( Feature feature ) { if ( feature != null ) { this . feature = feature ; copyToForm ( this . feature ) ; } else { this . feature = null ; featureForm . clear ( ) ; } }
Apply a new feature onto this widget . The feature will be immediately shown on the attribute form .
10,020
public void onClick ( MenuItemClickEvent event ) { FeatureTransaction ft = mapWidget . getMapModel ( ) . getFeatureEditor ( ) . getFeatureTransaction ( ) ; if ( ft != null && index != null ) { mapWidget . render ( ft , RenderGroup . VECTOR , RenderStatus . DELETE ) ; RemoveCoordinateOp op = new RemoveCoordinateOp ( ind...
Remove an existing point from the geometry at a given index .
10,021
public void onDoubleClick ( DoubleClickEvent event ) { if ( null != lastClickPosition ) { Bbox bounds = mapWidget . getMapModel ( ) . getMapView ( ) . getBounds ( ) ; double x = lastClickPosition . getX ( ) - ( bounds . getWidth ( ) / 4 ) ; double y = lastClickPosition . getY ( ) - ( bounds . getHeight ( ) / 4 ) ; Bbox...
Zoom in to the double - clicked position .
10,022
public void onCommunicationException ( Throwable error ) { String msg = I18nProvider . getGlobal ( ) . commandCommunicationError ( ) + ":\n" + error . getMessage ( ) ; Log . logWarn ( msg , error ) ; SC . warn ( msg ) ; }
Default behaviour for handling a communication exception . Shows a warning window to the user .
10,023
public void onCommandException ( CommandResponse response ) { String message = I18nProvider . getGlobal ( ) . commandError ( ) + ":" ; for ( String error : response . getErrorMessages ( ) ) { message += "\n" + error ; } Log . logWarn ( message ) ; if ( response . getExceptions ( ) == null || response . getExceptions ( ...
Default behaviour for handling a command execution exception . Shows an exception report to the user .
10,024
public void setFeature ( Feature feature ) { List < Feature > features = new ArrayList < Feature > ( ) ; features . add ( feature ) ; LazyLoader . lazyLoad ( features , GeomajasConstant . FEATURE_INCLUDE_ATTRIBUTES , new LazyLoadCallback ( ) { public void execute ( List < Feature > response ) { Feature feature = respon...
Apply a new feature onto this widget assuring the attributes are loaded .
10,025
public void setEditingEnabled ( boolean editingEnabled ) { if ( isEditingAllowed ( ) ) { this . editingEnabled = editingEnabled ; if ( editingEnabled ) { savePanel . setVisible ( true ) ; if ( attributeTable != null && attributeTable . isDisabled ( ) ) { attributeTable . setDisabled ( false ) ; } } else { savePanel . s...
Is editing currently enabled or not? This widget can toggle this value on the fly . When editing is enabled it will display an editable attribute form with save cancel and reset buttons . When editing is not enabled these buttons will disappear and a simple attribute form is shown that displays the attribute values but...
10,026
public static Geometry toDto ( org . geomajas . gwt . client . spatial . geometry . Geometry geometry ) { if ( geometry == null ) { return null ; } int srid = geometry . getSrid ( ) ; int precision = geometry . getPrecision ( ) ; Geometry dto ; if ( geometry instanceof Point ) { dto = new Geometry ( Geometry . POINT , ...
Takes in a GWT geometry and creates a new DTO geometry from it .
10,027
public static Bbox toDto ( org . geomajas . gwt . client . spatial . Bbox bbox ) { return new Bbox ( bbox . getX ( ) , bbox . getY ( ) , bbox . getWidth ( ) , bbox . getHeight ( ) ) ; }
Takes in a GWT bbox and creates a new DTO bbox from it .
10,028
public static org . geomajas . gwt . client . spatial . Bbox toGwt ( Bbox bbox ) { return new org . geomajas . gwt . client . spatial . Bbox ( bbox ) ; }
Takes in a DTO bbox and creates a new GWT bbox from it .
10,029
public int sendRpcMessage ( TLMethod request , long timeout , boolean highPriority ) { int id = scheduller . postMessage ( request , true , timeout , highPriority ) ; Logger . d ( TAG , "sendMessage #" + id + " " + request . toString ( ) + " with timeout " + timeout + " ms" ) ; return id ; }
Sending rpc request
10,030
public void switchMode ( int mode ) { if ( this . mode != mode ) { this . mode = mode ; switch ( mode ) { case MODE_GENERAL : case MODE_PUSH : transportPool . switchMode ( TransportPool . MODE_DEFAULT ) ; break ; case MODE_GENERAL_LOW_MODE : case MODE_FILE : transportPool . switchMode ( TransportPool . MODE_LOWMODE ) ;...
Switch mode of mtproto
10,031
private void onMTMessage ( MTMessage mtMessage ) { if ( mtMessage . getSeqNo ( ) % 2 == 1 ) { scheduller . confirmMessage ( mtMessage . getMessageId ( ) ) ; } if ( ! needProcessing ( mtMessage . getMessageId ( ) ) ) { if ( Logger . LOG_IGNORED ) { Logger . d ( TAG , "Ignoring messages #" + mtMessage . getMessageId ( ) ...
Finding message type
10,032
private List < org . geomajas . layer . tile . RasterTile > calculateTilesForBounds ( Bbox bounds ) { List < org . geomajas . layer . tile . RasterTile > tiles = new ArrayList < org . geomajas . layer . tile . RasterTile > ( ) ; if ( bounds . getHeight ( ) == 0 || bounds . getWidth ( ) == 0 ) { return tiles ; } return ...
Method based on WmsTileServiceImpl in GWT2 client .
10,033
public void initialize ( ClientMapInfo mapInfo ) { super . removeMembers ( getMembers ( ) ) ; ClientToolbarInfo toolbarInfo = mapInfo . getToolbar ( ) ; if ( toolbarInfo != null ) { for ( ClientToolInfo tool : toolbarInfo . getTools ( ) ) { String id = tool . getToolId ( ) ; if ( ToolId . TOOL_SEPARATOR . equals ( id )...
Initialize this widget .
10,034
public void addActionButton ( final ToolbarAction action ) { final IButton button = new IButton ( ) ; button . setWidth ( buttonSize ) ; button . setHeight ( buttonSize ) ; button . setIconSize ( buttonSize - WidgetLayout . toolbarStripHeight ) ; button . setIcon ( action . getIcon ( ) ) ; button . setActionType ( Sele...
Add a new action button to the toolbar . An action button is the kind of button that executes immediately when clicked upon . It can not be selected or deselected it just executes every click .
10,035
public void addToolbarSeparator ( ) { ToolStripSeparator stripSeparator = new ToolStripSeparator ( ) ; stripSeparator . setHeight ( WidgetLayout . toolbarStripHeight ) ; super . addMember ( stripSeparator ) ; }
Add a vertical line to the toolbar .
10,036
public void setCoordinate ( Coordinate coordinate ) { if ( coordinate == null ) { throw new IllegalArgumentException ( "Can't snap to a null coordinate." ) ; } this . coordinate = coordinate ; bounds = new Bbox ( coordinate . getX ( ) - rule . getDistance ( ) , coordinate . getY ( ) - rule . getDistance ( ) , rule . ge...
Set a new coordinate ready to be snapped .
10,037
public static String convertGlobToRegex ( String pattern ) { pattern = pattern . replaceAll ( "[\\\\\\.\\(\\)\\+\\|\\^\\$]" , "\\\\$0" ) ; pattern = pattern . replaceAll ( "\\[\\\\\\^" , "[^" ) ; pattern = Ruby . String . of ( pattern ) . gsub ( "\\{[^\\}]+\\}" , m -> { m = m . replaceAll ( "," , "|" ) ; m = "(" + m . ...
Converts a glob pattern to Regex string .
10,038
public boolean addAdministrator ( String projectId , String name , String email ) { ResponseWrapper wrapper = service . addProjectMember ( Action . ADD_CONTRIBUTOR , apiKey , projectId , name , email , null , 1 ) ; return "200" . equals ( wrapper . response . code ) ; }
Create a new admin for a project
10,039
public TermsDetails addTerms ( String projectId , List < Term > terms ) { String jsonTerms = new Gson ( ) . toJson ( terms ) ; EditTermsResponse atr = service . editTerms ( Action . ADD_TERMS , apiKey , projectId , jsonTerms ) ; ApiUtils . checkResponse ( atr . response ) ; return atr . details ; }
Add new terms to a project
10,040
public File export ( String projectId , String language , FileTypeEnum fte , FilterByEnum [ ] filters ) { return export ( projectId , language , fte , filters , null , null ) ; }
Export a translation for a language of a project .
10,041
public UploadDetails uploadTerms ( String projectId , File translationFile , String [ ] allTags , String [ ] newTags , String [ ] obsoleteTags ) { Map < String , String [ ] > tags = new HashMap < String , String [ ] > ( ) ; if ( allTags != null ) { tags . put ( "all" , allTags ) ; } if ( newTags != null ) { tags . put ...
Uploads a translation file . For the moment it only takes terms into account .
10,042
private static String decodeLineString ( LineString lineString ) { if ( lineString == null || lineString . isEmpty ( ) ) { return "" ; } StringBuilder buffer = new StringBuilder ( ) ; Coordinate [ ] coordinates = lineString . getCoordinates ( ) ; for ( int i = 0 ; i < coordinates . length ; i ++ ) { buffer . append ( g...
Decode LineString .
10,043
GeometryIndex [ ] getSelection ( ) { List < GeometryIndex > indices = delegate . getSelection ( ) ; return indices . toArray ( new GeometryIndex [ indices . size ( ) ] ) ; }
Get the current selection . Do not make changes on this list!
10,044
@ SuppressFBWarnings ( value = "NP_BOOLEAN_RETURN_NULL" , justification = "That's the point (but dubious)" ) public static Boolean falseToNull ( Boolean bool ) { if ( bool != null && bool ) { return true ; } return null ; }
If bool is false change it to null otherwise do nothing .
10,045
public static void mixin ( Window window ) { final Docker docker = new Docker ( window ) ; window . addMinimizeClickHandler ( docker ) ; window . addRestoreClickHandler ( docker ) ; }
Add the functionality to an existing window .
10,046
public static HLayout createDefaultDock ( ) { HLayout windowDock = new HLayout ( 5 ) ; windowDock . setHeight ( 22 ) ; windowDock . setAutoWidth ( ) ; windowDock . setSnapTo ( "BL" ) ; windowDock . setSnapOffsetTop ( - 0 ) ; windowDock . setSnapOffsetLeft ( 0 ) ; windowDock . setBorder ( "thin dashed red" ) ; return wi...
This will create a windowDock based on a HLayout and placed in the dockParent if provided .
10,047
@ Consumes ( "multipart/form-data" ) @ RequiresPermissions ( I18nPermissions . KEY_WRITE ) public Response importTranslations ( FormDataMultiPart multiPart ) { WebAssertions . assertNotNull ( multiPart , "Missing input file" ) ; int importedKeys = 0 ; for ( BodyPart bodyPart : multiPart . getBodyParts ( ) ) { importedK...
Imports one or more CSV files containing i18n keys with their translations .
10,048
@ Produces ( MediaType . TEXT_PLAIN ) @ RequiresPermissions ( I18nPermissions . KEY_READ ) public Response exportTranslations ( ) { final List < Key > keys = keyRepository . loadAll ( ) ; return Response . ok ( new StreamingOutput ( ) { private boolean isFirstLine = true ; public void write ( OutputStream os ) throws I...
Streams a CSV file with all keys with their translations .
10,049
public static void main ( String [ ] args ) throws IOException { if ( args . length == 0 ) { System . out . println ( "No command given, choose: \n\tinit\n\tpull\n\tpush\n\tpushTerms" ) ; return ; } Map < String , String > parameters = new HashMap < String , String > ( ) ; if ( args . length > 1 ) { for ( String s : ar...
By default read config from current dir
10,050
public void doActivities ( Object seedData ) { List < Activity > activities = getActivities ( ) ; if ( seedData != null ) { context . setSeedData ( seedData ) ; } for ( Activity activity : activities ) { try { context = activity . execute ( context ) ; } catch ( Throwable th ) { WorkflowErrorHandler errorHandler = acti...
This method kicks off the processing of workflow activities . It goes over them one by one and executes them .
10,051
private boolean processShouldStop ( WorkflowContext workflowContext , Activity activity ) { if ( workflowContext != null && workflowContext . stopProcess ( ) ) { return true ; } return false ; }
Determine if the process should stop
10,052
public static String join ( List < String > parts , String separator ) { Iterator < String > it = parts . iterator ( ) ; StringBuilder builder = new StringBuilder ( ) ; while ( it . hasNext ( ) ) { String part = it . next ( ) ; builder . append ( part ) ; if ( it . hasNext ( ) ) { builder . append ( separator ) ; } } r...
Joins a list of strings using the specified separator .
10,053
public static org . geomajas . geometry . Bbox constructor ( double x , double y , double width , double height ) { return new org . geomajas . geometry . Bbox ( x , y , width , height ) ; }
Bbox constructor .
10,054
public static LinkedHashMap < String , String > getSearchWidgetMapping ( ) { LinkedHashMap < String , String > map = new LinkedHashMap < String , String > ( ) ; for ( SearchWidgetCreator swc : REGISTRY . values ( ) ) { map . put ( swc . getSearchWidgetId ( ) , swc . getSearchWidgetName ( ) ) ; } return map ; }
Get a list with all the ids + names of the search widgets in the registry .
10,055
public List < SearchCriterion > getSearchCriteria ( ) { List < SearchCriterion > criteria = new ArrayList < SearchCriterion > ( ) ; for ( AttributeCriterionPane criterionPane : criterionPanes ) { if ( criterionPane . hasErrors ( ) ) { SC . warn ( I18nProvider . getSearch ( ) . warningInvalidCriteria ( ) ) ; return null...
Get the full list of search criteria from the criterion grid .
10,056
public void empty ( ) { searchButton . setDisabled ( true ) ; resetButton . setDisabled ( true ) ; for ( AttributeCriterionPane criterionPane : criterionPanes ) { criterionStack . removeMember ( criterionPane ) ; } criterionPanes . clear ( ) ; for ( HLayout criterionPane : buttonPanes ) { buttonStack . removeMember ( c...
Empty the grid thereby removing all rows . When that is done a new empty row will be displayed .
10,057
public void setLogicalOperator ( LogicalOperator operator ) { switch ( operator ) { case AND : logicalOperatorRadio . setValue ( I18nProvider . getSearch ( ) . radioOperatorAnd ( ) ) ; break ; case OR : logicalOperatorRadio . setValue ( I18nProvider . getSearch ( ) . radioOperatorOr ( ) ) ; break ; default : throw new ...
Set a new value for the logical operator . This operator determines whether all the criteria have to be met in the search or just one of them .
10,058
public LogicalOperator getLogicalOperator ( ) { String value = ( String ) logicalOperatorRadio . getValue ( ) ; if ( value . equals ( I18nProvider . getSearch ( ) . radioOperatorAnd ( ) ) ) { return LogicalOperator . AND ; } return LogicalOperator . OR ; }
Return the current value for the logical operator . This operator determines whether all the criteria have to be met in the search or just one of them .
10,059
public void setLayer ( VectorLayer layer ) { this . layer = layer ; Object value = layerSelect . getValue ( ) ; if ( value == null || ! value . equals ( layer . getLabel ( ) ) ) { layerSelect . setValue ( layer . getLabel ( ) ) ; } empty ( ) ; }
Set a new layer onto which searching should happen .
10,060
public void addTranslationDTO ( String locale , String value , boolean outdated , boolean approximate ) { translations . add ( new TranslationDTO ( locale , value , outdated , approximate ) ) ; }
Adds a translation to the keyDTO
10,061
public static String scaleToString ( double scale , int precision , int significantDigits ) { NumberFormat numberFormat = NumberFormat . getFormat ( "###,###" ) ; if ( scale > 0 && scale < 1.0 ) { int denominator = round ( ( int ) Math . round ( 1.0 / scale ) , precision , significantDigits ) ; return "1 : " + numberFo...
Convert a scale to a string representation .
10,062
public static Double stringToScale ( String value ) { NumberFormat numberFormat = NumberFormat . getFormat ( "###,###" ) ; String [ ] scale2 = value . split ( ":" ) ; if ( scale2 . length == 1 ) { return 1.0 / numberFormat . parse ( scale2 [ 0 ] . trim ( ) ) ; } else { return numberFormat . parse ( scale2 [ 0 ] . trim ...
Parse scale from string representation .
10,063
static int round ( int value , int precision , int significantDigits ) { if ( precision > 0 ) { value = ( value + precision / 2 ) / precision * precision ; } if ( significantDigits > 0 ) { int forRounding = value ; int precisionMax = ( int ) Math . pow ( 10 , significantDigits ) ; int multiplier = 1 ; while ( value > p...
Round integer number by applying precision and maximum significant digits .
10,064
public synchronized void put ( byte [ ] data ) { references . remove ( data ) ; if ( mainFilter . add ( data ) ) { for ( Integer i : SIZES ) { if ( data . length == i ) { fastBuffers . get ( i ) . add ( data ) ; return ; } } if ( data . length <= MAX_SIZE ) { return ; } byteBuffer . add ( data ) ; } }
Put bytes to cache
10,065
public synchronized byte [ ] allocate ( int minSize ) { if ( minSize <= MAX_SIZE ) { for ( int i = 0 ; i < SIZES . length ; i ++ ) { if ( minSize < SIZES [ i ] ) { if ( ! fastBuffers . get ( SIZES [ i ] ) . isEmpty ( ) ) { Iterator < byte [ ] > interator = fastBuffers . get ( SIZES [ i ] ) . iterator ( ) ; byte [ ] res...
Allocating new byte array with minimal size
10,066
public static OwncloudFileResource toOwncloudFileResource ( OwncloudResource owncloudResource ) throws OwncloudNoFileResourceException { if ( owncloudResource == null ) { return null ; } if ( isDirectory ( owncloudResource ) || ! ClassUtils . isAssignable ( owncloudResource . getClass ( ) , OwncloudFileResource . class...
Convert a OwncloudResource to a OwncloudFileResource .
10,067
public static boolean isDirectory ( OwncloudResource owncloudResource ) { return UNIX_DIRECTORY . equals ( Optional . ofNullable ( owncloudResource ) . map ( resource -> resource . getMediaType ( ) . toString ( ) ) . orElse ( null ) ) ; }
Checks if the OwncloudResource is a Directory
10,068
public void refresh ( ) { if ( layer instanceof RasterLayer ) { RasterLayer rLayer = ( RasterLayer ) layer ; rLayer . setVisible ( false ) ; rLayer . getStore ( ) . clear ( ) ; rLayer . setVisible ( true ) ; } else if ( layer instanceof org . geomajas . gwt . client . map . layer . VectorLayer ) { org . geomajas . gwt ...
Completely clear all rendering of this layer and redraw .
10,069
public static boolean hasConstructorInTheCorrectForm ( Class < ? > clazz ) { if ( clazz . getConstructors ( ) . length != 1 ) { return false ; } Constructor < ? > con = clazz . getConstructors ( ) [ 0 ] ; if ( con . getParameterTypes ( ) . length == 0 ) { return false ; } Annotation [ ] [ ] parameterAnnotations = con ....
Check if the given class has the correct form .
10,070
private Composite getOrCreateGroup ( Object parent , String name ) { if ( groups . containsKey ( name ) ) { return groups . get ( name ) ; } Composite group = new Composite ( name ) ; mapWidget . getVectorContext ( ) . drawGroup ( parent , group ) ; groups . put ( name , group ) ; return group ; }
Used in creating the edges selection and vertices groups for LineStrings and LinearRings .
10,071
public void onDraw ( ) { map . getVectorContext ( ) . setController ( parent , getId ( ) , controller , Event . MOUSEEVENTS ) ; map . getVectorContext ( ) . setCursor ( parent , getId ( ) , Cursor . POINTER . getValue ( ) ) ; }
When this pan button is drawn for the first time add a pan controller to it that reacts on the click event .
10,072
public static void assertNotBlank ( String actual , String message ) { if ( StringUtils . isBlank ( actual ) ) { throw new BadRequestException ( message ) ; } }
Throws a BadRequestException if actual is null .
10,073
public void onModuleLoad ( ) { ToolbarRegistry . put ( RasterizingToolId . GET_LEGEND_IMAGE , new ToolCreator ( ) { public ToolbarBaseAction createTool ( MapWidget mapWidget ) { return new GetLegendImageAction ( mapWidget ) ; } } ) ; ToolbarRegistry . put ( RasterizingToolId . GET_MAP_IMAGE , new ToolCreator ( ) { publ...
Registers toolbar actions .
10,074
public static byte [ ] toArray ( Collection < ? extends Number > bytes ) { byte [ ] array = new byte [ bytes . size ( ) ] ; Iterator < ? extends Number > iter = bytes . iterator ( ) ; for ( int i = 0 ; i < bytes . size ( ) ; i ++ ) { array [ i ] = iter . next ( ) . byteValue ( ) ; } return array ; }
Converts a Collection of Number to a byte array .
10,075
public static byte [ ] ljust ( byte [ ] bytes , int width ) { if ( bytes . length >= width ) { return Arrays . copyOf ( bytes , width ) ; } else { byte [ ] ljustied = new byte [ width ] ; System . arraycopy ( bytes , 0 , ljustied , 0 , bytes . length ) ; return ljustied ; } }
Modifies the length of a byte array by padding zero bytes to the right .
10,076
public static byte [ ] rjust ( byte [ ] bytes , int width ) { if ( bytes . length >= width ) { return Arrays . copyOfRange ( bytes , bytes . length - width , bytes . length ) ; } else { byte [ ] rjustied = new byte [ width ] ; System . arraycopy ( bytes , 0 , rjustied , width - bytes . length , bytes . length ) ; retur...
Modifies the length of a byte array by padding zero bytes to the left .
10,077
public static void reverse ( byte [ ] bytes ) { for ( int i = 0 ; i < bytes . length / 2 ; i ++ ) { byte temp = bytes [ i ] ; bytes [ i ] = bytes [ bytes . length - 1 - i ] ; bytes [ bytes . length - 1 - i ] = temp ; } }
Reverses a byte array in place .
10,078
public static byte [ ] toByteArray ( short s , ByteOrder bo ) { return ByteBuffer . allocate ( 2 ) . order ( bo ) . putShort ( s ) . array ( ) ; }
Converts a short into a byte array .
10,079
public static byte [ ] toByteArray ( int i , ByteOrder bo ) { return ByteBuffer . allocate ( 4 ) . order ( bo ) . putInt ( i ) . array ( ) ; }
Converts an int into a byte array .
10,080
public static byte [ ] toByteArray ( long l , ByteOrder bo ) { return ByteBuffer . allocate ( 8 ) . order ( bo ) . putLong ( l ) . array ( ) ; }
Converts a long into a byte array .
10,081
public static byte [ ] toByteArray ( float f , ByteOrder bo ) { return ByteBuffer . allocate ( 4 ) . order ( bo ) . putFloat ( f ) . array ( ) ; }
Converts a float into a byte array .
10,082
public static byte [ ] toByteArray ( double d , ByteOrder bo ) { return ByteBuffer . allocate ( 8 ) . order ( bo ) . putDouble ( d ) . array ( ) ; }
Converts a double into a byte array .
10,083
public static byte [ ] toByteArray ( char c , ByteOrder bo ) { return ByteBuffer . allocate ( 2 ) . order ( bo ) . putChar ( c ) . array ( ) ; }
Converts a char into a byte array .
10,084
public static String toExtendedASCIIs ( byte [ ] bytes , int n , ByteOrder bo ) { RubyArray < String > ra = Ruby . Array . create ( ) ; if ( bo == LITTLE_ENDIAN ) { for ( int i = 0 ; i < n ; i ++ ) { if ( i >= bytes . length ) { ra . push ( "\0" ) ; continue ; } byte b = bytes [ i ] ; ra . push ( toASCII8Bit ( b ) ) ; ...
Converts a byte array into an ASCII String .
10,085
public static String toUTF ( byte [ ] bytes ) { int codePoint = ByteBuffer . wrap ( bytes ) . getInt ( ) ; if ( codePoint < 0 || codePoint > 0X10FFFF ) throw new IllegalArgumentException ( "RangeError: pack(U): value out of range" ) ; return String . valueOf ( ( char ) codePoint ) ; }
Converts a byte array into an UTF String .
10,086
public static String toBinaryString ( byte [ ] bytes , boolean isMSB ) { StringBuilder sb = new StringBuilder ( ) ; for ( byte b : bytes ) { String binary = String . format ( "%8s" , Integer . toBinaryString ( b & 0xFF ) ) . replace ( ' ' , '0' ) ; if ( isMSB ) sb . append ( binary ) ; else sb . append ( new StringBuil...
Converts a byte array to a binary String .
10,087
public static String toHexString ( byte [ ] bytes , boolean isHNF ) { StringBuilder sb = new StringBuilder ( ) ; for ( byte b : bytes ) { String hex = String . format ( "%2s" , Integer . toHexString ( b & 0xFF ) ) . replace ( ' ' , '0' ) ; if ( isHNF ) sb . append ( hex ) ; else sb . append ( new StringBuilder ( hex ) ...
Converts a byte array to a hex String .
10,088
public static byte [ ] fromBinaryString ( String binaryStr ) { if ( ! binaryStr . matches ( "^[01]*$" ) ) throw new IllegalArgumentException ( "Invalid binary string" ) ; if ( binaryStr . isEmpty ( ) ) return new byte [ 0 ] ; int complementary = binaryStr . length ( ) % 8 ; if ( complementary != 0 ) binaryStr += Ruby ....
Converts a binary string into byte array .
10,089
public static byte [ ] fromHexString ( String hexStr ) { if ( ! hexStr . matches ( "^[0-9A-Fa-f]*$" ) ) throw new IllegalArgumentException ( "Invalid hexadecimal string" ) ; if ( hexStr . isEmpty ( ) ) return new byte [ 0 ] ; int complementary = hexStr . length ( ) % 2 ; if ( complementary != 0 ) hexStr += "0" ; return...
Converts a hexadecimal string into byte array .
10,090
public org . geomajas . layer . feature . Feature toDto ( ) { org . geomajas . layer . feature . Feature dto = new org . geomajas . layer . feature . Feature ( ) ; dto . setAttributes ( attributes ) ; dto . setClipped ( clipped ) ; dto . setId ( id ) ; dto . setGeometry ( GeometryConverter . toDto ( geometry ) ) ; dto ...
Transform this object into a DTO feature .
10,091
public void setAttributes ( Map < String , Attribute > attributes ) { if ( null == attributes ) { throw new IllegalArgumentException ( "Attributes should be not-null." ) ; } this . attributes = attributes ; this . attributesLoaded = true ; }
Set the attributes map .
10,092
public void setRectangleStyle ( ShapeStyle rectangleStyle ) { this . rectangleStyle = rectangleStyle ; if ( targetRectangle != null ) { targetRectangle . setStyle ( rectangleStyle ) ; render ( targetRectangle , RenderGroup . SCREEN , RenderStatus . ALL ) ; } }
Set a new style for the rectangle that shows the current position on the target map .
10,093
public void setDrawTargetMaxExtent ( boolean drawTargetMaxExtent ) { this . drawTargetMaxExtent = drawTargetMaxExtent ; if ( drawTargetMaxExtent ) { targetMaxExtentRectangle = new GfxGeometry ( "targetMaxExtentRectangle" ) ; targetMaxExtentRectangle . setStyle ( targetMaxExtentRectangleStyle ) ; Bbox targetMaxExtent = ...
Determine whether or not a rectangle that shows the target map s maximum extent should be shown .
10,094
public void setTargetMaxExtentRectangleStyle ( ShapeStyle targetMaxExtentRectangleStyle ) { this . targetMaxExtentRectangleStyle = targetMaxExtentRectangleStyle ; if ( targetMaxExtentRectangle != null ) { targetMaxExtentRectangle . setStyle ( targetMaxExtentRectangleStyle ) ; if ( drawTargetMaxExtent ) { render ( targe...
Set a new style for the rectangle that show the target map s maximum extent . This style will be applied immediately .
10,095
private void updateMaxExtent ( ) { if ( targetMap . getMapModel ( ) . isInitialized ( ) && getGraphics ( ) . isReady ( ) ) { getMapModel ( ) . getMapView ( ) . setSize ( getWidth ( ) , getHeight ( ) ) ; Bbox targetMaxBounds = getOverviewMaxBounds ( ) ; MapView mapView = getMapModel ( ) . getMapView ( ) ; mapView . setM...
Apply a maximum extent . This will extend the map extend to be used by the percentage to increase .
10,096
private void updatePov ( ) { MapView mapView = getMapModel ( ) . getMapView ( ) ; WorldViewTransformer transformer = new WorldViewTransformer ( mapView ) ; Bbox targetBox = targetMap . getMapModel ( ) . getMapView ( ) . getBounds ( ) ; Bbox overviewBox = mapView . getBounds ( ) ; if ( Double . isNaN ( overviewBox . get...
Update the rectangle and perhaps the entire map if needed .
10,097
private Bbox getOverviewMaxBounds ( ) { Bbox targetMaxBounds ; if ( ! useTargetMaxExtent ) { targetMaxBounds = new Bbox ( getMapModel ( ) . getMapInfo ( ) . getInitialBounds ( ) ) ; } else { if ( targetMap . getMapModel ( ) . isInitialized ( ) ) { targetMaxBounds = targetMap . getMapModel ( ) . getMapView ( ) . getMaxB...
The maximum bounds depend on whether useTargetMaxExtent was set . If not set the initialBounds from the overviewMap are used . It it was set the maximum bounds of the target view is used .
10,098
@ Produces ( MediaType . APPLICATION_JSON ) public Response getStatistics ( @ QueryParam ( "selectLang" ) String locale ) { List < StatisticRepresentation > listResult = new ArrayList < > ( ) ; if ( StringUtils . isBlank ( locale ) ) { List < LocaleRepresentation > availableLocales = localeFinder . findAvailableLocales...
Returns a list contains the result statistic for the selected language
10,099
@ SuppressWarnings ( "unchecked" ) public < T > T getProperty ( String key , T defaultValue ) { T value = ( T ) serviceReference . getProperty ( key ) ; return value == null ? defaultValue : value ; }
Returns the service property value or the default value if the property is not present .